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

RETRIEVING NEXT FIELD VALUES & CONCATENATION

Status
Not open for further replies.

kellej5

Programmer
Sep 9, 2004
3
US
Okay, here's the problem:

While my report is being generated, up to three records at a time need to be concatenated and displayed on one line. I know how to simply use the Next(fld) function to look ahead to the next field value and conditionally tell Crystal to concatenate the next field value to the end of the current field value. I then have the report drill down the next value and continue on. The problem is, the third value gets displayed on its own line. My question is, is there a way to look down the field values further than just to the next one? Any comments/ideas would be helpful!
 
There are a few problems, the basic one being that you haven't given much technical information, rather a description.

Crystal version
Database/coneectivity
Example data
Expected output

In general you can just conccatenate values without the next or previous function, as in:

Group Header formula:
whileprintingrecords;
stringvar AllNames:="";

Details:
whileprintingrecords;
stringvar AllNames;
if {table.conditionfield} = "Y" then
AllNames:=AllNames+{table.field}

Group Footer formula for display:
whileprintingrecords;
stringvar AllNames

-k
 
Thanks for getting back so quick. Sorry about the lack of description, office was closing for the weekend and I tried to get it in before they kicked me out.

Crystal ver. - 9

Database - An ODBC connection to SQL Server, a stored procedure is used to retrieve the data.

Example Data -
field1 field2 field3
widget1 WD yes
widget1 WEd no
widget1 WDss no

Expected result - The details line is supposed to look like this :

field1 field2
widget1 WD/WEd/WDss

Currently it looks like this -

field1 field2
widget1 WD/WEd

We currenlty use a formula to display field2 -
Code:
//bSup is a BooleanVar that tells details to suppress the following record

If  Next({StoredProcedure.field3}) = "no" 
  and (Uppercase(Next({StoredProcedure.field1})) = Uppercase({StoredProcedure.field1}))
then 
  (bSup := true;  
  {StoredProcedure.field2}& " / " & Next({StoredProcedure.field2}))
else              
  (bSup := false; 
  {StoredProcedure.field2})
Hope this is a little more descriptive. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top