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

Loop not returning data 1

Status
Not open for further replies.

pator

MIS
Sep 28, 2004
17
IE
I'm using Crystal XI reporting of SAP.
I use Remote Function Call (RFC)to retrieve comments
from SAP for Particular records.I use a shared variable to return these comments into the details section of my report.(This works OK)
I then want to loop through the shared variable and line up the comments with the appropriate record in the report footer.
This is where I'm falling down.
After looping through the shared variable I just get the word TRUE returned instead of the text in the variable.

The reason I don't just put the shared variable into the report footer is that it only shows the last comment returned in the details section and not them all.

My code to Loop is below, Can you check please if this code is correct or point me in another direction.

Whileprinting Records;
shared stringvar Kcomments;

Numbervar i:=0
shared stringvar Kcomments;
for i :=1 to count ({myfield}) step 1 do
shared stringvar Kcomments;

Regards & Thanks
Pator

 
You need to add a formula like the following to your detail section (a loop won't work here):

Whileprinting Records;
shared stringvar Kcomments;
stringvar allcomments := allcomments + Kcomments + "; ";

(Not sure whether you want a divider, so delete the "; ", if not).

Then in the report footer, add this formula:

whileprintingrecords;
stringvar allcomments;
left(allcomments,len(allcomments)-2); //delete this line if you are not using a divider

This will collect all comments in the report footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top