Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variables 1

Status
Not open for further replies.

bxgirl

Programmer
Nov 21, 2005
75
US
Using CR 7, mysql v.4

This is what my output looks like now

Customer Service Desc Service Date
---------------------------------------
Cust1 ServDesc1 12/2/05
Cust1 ServDesc2 12/2/05
Cust1 ServDesc3 12/15/05

What I'm trying to do is for the dates that are the same, concatenate the service desc so they appear on the same line like the following:

Customer Service Desc Service Date
-----------------------------------------------
Cust1 ServDesc1, ServDesc2 12/2/05
Cust1 ServDesc3 12/15/05



I've setup the following formulas:

In GH to reset

whileprintingrecords;
StringVar ServDesc:="";
stringVar strDate := "" ;

In detail section

whileprintingrecords;
StringVar ServDesc;
StringVar strDate;
StringVar prevDate;

strDate := ToText ({tbl_report.ServDate});

if totext({tbl_report.DateBeg}) = strDate then
ServDesc := ServDesc + ", " + {tbl_report.ServDesc}

else
ServDesc := {tbl_report.ServDesc}


Appreciate any help.
 
Group by customer and then by service date. Place your reset formula in the group header for service date, then place the following formula in your detail section:

//{@accum}:
whileprintingrecords;
StringVar ServDesc;
ServDesc := ServDesc + {tbl_report.ServDesc} + ", ";

//{@display} to be placed in the group footer (date):
whileprintingrecords;
StringVar ServDesc;
left(ServDesc, len(ServDesc)-2);

Place the Group#1 and Group#2 groupnames in the group #2 footer, along with {@display}, and then suppress the group headers and detail section.

-LB
 
I have the same question like this one but when I run the report, I got an error "String length is less than 0 or not an integer". Please help.

The output is like this:

CustomerID RXDate RX Desc
125 01/05/2005 INH 500 Mg
125 01/05/2005 RIF 100 RX
125 07/20/2005 PZA 2800 Mg
125 07/20/2005 B6 100 Mg

I would like the output look like this:
Customer ID RX Date RX Desc
125 01/05/2005 INH 500 Mg, RIF 100 RX
125 07/20/2005 PZA 2800 Mg, B6 100 Mg

So first I created 3 fomular named: (@Reset), (@Accum) and (@Display),
I placed the (@Reset) in group header #2 (RXDate) like this:

whileprintingrecords;
StringVar RXDesc := "";
stringVar strDate := "" ;

Then I placed the (@Accum) in Detail Section like this:

whileprintingrecords;
StringVar RXDesc;
RXDesc := RXDesc+ {table.RXDesc} + ", ";

Last I placed the (@Display) in the group footer #2 (RX Date) along with other fields Group#1 and Group#2 groupnames, then suppress the group headers (Customer ID and RX Date) and detail section like you said

whileprintingrecords;
StringVar RXDesc;
left(RXDesc, len(RXDesc)-2);

But I got an error when running the report, error show in (@Display) "The string length is less than 0 or not an integer". Please help, I'm very appreciated. Thanks
 
Just ignored my question, I found the solution and it worked. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top