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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

whileprintingrecords;?

Status
Not open for further replies.

tweetyng

MIS
Feb 23, 2006
46
US
I created a report with formulas:

In group header:
(@Reset):

whileprintingrecords;
StringVar RXDesc := "";

Group footer:
(@Display):

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

And In detail:
(@Accum):

whileprintingrecords;

if not isnull ({@RXDesc}) and ({@RXDesc}) <> " "
then stringvar RXDesc := RXDesc + {@RXDesc} +", "
else if length (RXDesc) = 0
then stringvar RXDesc := RXDesc + "N/A ;"
else stringvar RXDesc := RXDesc

Suppressed groupheader, detail, etc... except groupfooter.

My results showing:

DateCollected Result Resistant Sensitive
11/01/02 Neg N/A N/A
12/01/03 Pos N/A N/A ; ETM, INH, STR
02/08/04 Neg N/A N/A
10/08/06 Neg N/A ;EMB, PZA N/A

It supposes to show like this:

DateCollected Result Resistant Sensitive
11/01/02 Neg N/A N/A
12/01/03 Pos N/A ETM, INH, STR
02/08/04 Neg N/A N/A
10/08/06 Neg EMB, PZA N/A

If having records then it’s not supposed to show N/A;
So please help, thanks

Each customer on each page and group by CustomerID
Thanks

TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
The first time through the {@RXDesc} is blank, hence you get a N/A.

Hard to know exactly because you reference the formula {@RXDesc} and not show what's in there, please think your posts through, we have no idea what are in embedded formulas.

And things like:

else stringvar RXDesc := RXDesc

are redundant, you don't need to tell a variable to maintain it's value.

Try:
//details
whileprintingrecords;
stringvar RXDesc;
if trim({@RXDesc}) <> "" then
RXDesc := RXDesc + {@RXDesc} +", "

Group footer:
//(@Display):
whileprintingrecords;
StringVar RXDesc;
if len(RXDesc) = 2 then
"N/A"
else
left(RXDesc, len(RXDesc)-2);

Might get you close, otherwise post dependencies in your formulas.

-k
 
Thanks for your response - synapsevampire

I tried with your recommended with the codes above and I got an error pop up in ({@Display}) such as "String length is less than 0 or not an integer"

Below is my code for ({@RXDesc}) :

trim(if isnull ({table.Code}) or ({table.Code}) = "" then "" else ({table.Code})
Please help, thanks
I'm very appreciated.

TN (USA). I'm using Windows XP, Crystal Reports 10 and SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top