bhavesh55
asked on
Formula field in Report Header....
Dear Experts,
->Formula @Source:
Shared stringvar strval;
if recordnumber > 1 and {StoredProcedure_SP;1.ID} <> previous({StoredProcedure_ SP;1.ID}) then
strval:= "BOTH"
Else
{StoredProcedure_SP;1.Clie ntS}
->Formula @Test:
shared stringvar strval;
strval;
-> My report is pulling 3 records from the database.
I kept following fields in my detail section of the report: ID,@Test,@Source
My report shows following values for above 3 items(ID,@Test,@Source):
Result:
2 CS
3 BOTH BOTH
3 BOTH RE
@Test formula shows result "BOTH" in 2nd row because value of ID is different compare to first row,which is right.But now if i put another @Test formula in REPORT HEADER section than it is not showing me anything over there but it is still showing me values in DETAIL section of the report.
Some or how i want to display "BOTH" in REPORT HEADER section when value of ID change as i wrote in @Source formula. Please let me know how do i do that ?
Thanks.
->Formula @Source:
Shared stringvar strval;
if recordnumber > 1 and {StoredProcedure_SP;1.ID} <> previous({StoredProcedure_
strval:= "BOTH"
Else
{StoredProcedure_SP;1.Clie
->Formula @Test:
shared stringvar strval;
strval;
-> My report is pulling 3 records from the database.
I kept following fields in my detail section of the report: ID,@Test,@Source
My report shows following values for above 3 items(ID,@Test,@Source):
Result:
2 CS
3 BOTH BOTH
3 BOTH RE
@Test formula shows result "BOTH" in 2nd row because value of ID is different compare to first row,which is right.But now if i put another @Test formula in REPORT HEADER section than it is not showing me anything over there but it is still showing me values in DETAIL section of the report.
Some or how i want to display "BOTH" in REPORT HEADER section when value of ID change as i wrote in @Source formula. Please let me know how do i do that ?
Thanks.
The report header is built only once and the only record available to it is the first record therefore there is no way the value has changed since the previous record doesn't exist.
What are you trying to do?
mlmcc
What are you trying to do?
mlmcc
ASKER
Hi mlmcc,
Whatever the records report is retrieving, if it has MORE THAN ONE DIFFERENT kinds of values in "ID" field(e.g. here we have two different ID = 2 & 3) than i want to change the report header(="BOTH"), otherwise value of report header will come from database if all records of the report has SAME VALUE of field ID.
I am trying to do this logic:
when first condition becomes true in Formula @Source, than strval:= "BOTH" that value i want to display in Report header.So value of strval i am trying to pass to another formula which is @test so that formula can display the STORED value of variable strval in report header.
So Please let me know as soon as possible if there is some other way of doing it.
Thanks.
Whatever the records report is retrieving, if it has MORE THAN ONE DIFFERENT kinds of values in "ID" field(e.g. here we have two different ID = 2 & 3) than i want to change the report header(="BOTH"), otherwise value of report header will come from database if all records of the report has SAME VALUE of field ID.
I am trying to do this logic:
when first condition becomes true in Formula @Source, than strval:= "BOTH" that value i want to display in Report header.So value of strval i am trying to pass to another formula which is @test so that formula can display the STORED value of variable strval in report header.
So Please let me know as soon as possible if there is some other way of doing it.
Thanks.
The only way to do this is to put a subreport in the report header that figures out whether to say both or use the value.
In the subreport
Global Report header add a formula
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the detail section
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the report footer
Global StringVar Heading;
Heading
Put the subreport in the report header. It should just show the proper value.
mlmcc
In the subreport
Global Report header add a formula
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the detail section
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the report footer
Global StringVar Heading;
Heading
Put the subreport in the report header. It should just show the proper value.
mlmcc
ASKER
Hi mlmcc,
Sorry for the delay. Actually i was too busy.Where do you want me to put above mentioned 3 sets of lines ?
In the subreport, do you want me to put below 2 lines in one formula and put that formula in subreport's report header ? Please advice.
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the detail section, you want me to put these 4 lines in one formula and put that formula in subreport's detail section or main report's detail section ? please advice.
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the report footer,you want me to put these 2 lines in one formula of main report or sub report ?
Global StringVar Heading;
Heading
Thanks.
Sorry for the delay. Actually i was too busy.Where do you want me to put above mentioned 3 sets of lines ?
In the subreport, do you want me to put below 2 lines in one formula and put that formula in subreport's report header ? Please advice.
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the detail section, you want me to put these 4 lines in one formula and put that formula in subreport's detail section or main report's detail section ? please advice.
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the report footer,you want me to put these 2 lines in one formula of main report or sub report ?
Global StringVar Heading;
Heading
Thanks.
Not sure. Let me review the question and remember what I was thinking
mlmcc
mlmcc
ASKER
Hi mlmcc,
you didn't get a chance to review the question like where do i put those formulas ?
Thanks,
bob
you didn't get a chance to review the question like where do i put those formulas ?
Thanks,
bob
Sorry. Lost track of this. It took me some time tonight to figure out what I was trying to suggest.
Put a subreport in the Main report header
In the subreport Report Header
Formula - DeclVars
WhilePrintingRecords;
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the subreport Details
WhilePrintingRecords;
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the subreport Report Footer
WhilePrintingRecords;
Global StringVar Heading;
Heading
Use the same SQL or tables for the subreport
mlmcc
Put a subreport in the Main report header
In the subreport Report Header
Formula - DeclVars
WhilePrintingRecords;
Global NumberVar CurrentID := {IDField};
StringVar Heading := ToText ({IDField},0);
In the subreport Details
WhilePrintingRecords;
Global NumberVar CurrentID;
Global StringVar Heading;
If CurrentID <> {IDField} then
Heading := "Both"
In the subreport Report Footer
WhilePrintingRecords;
Global StringVar Heading;
Heading
Use the same SQL or tables for the subreport
mlmcc
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks.