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!

CR XI - Loop array variable in details section

Status
Not open for further replies.

ReportDr00

IS-IT--Management
Mar 2, 2007
194
US
I have column that stores pipe delimited data like below and i want to split and create array and dispaly each index value in details section

A1="test|fdsfas|testasdfa|asdfas"

details test
details fdsfas
details testasdfa
details asdfas

how should i go about doing it? any ideas? Appreciate your feedback

Regards
 
I think you will need a formula for each value, which you could then place in the details section of the report.

something like:
//{@SplitonBar01}
IF [Ubound(Split({table.A1},"|"))]>0 THEN
Split({table.A1},"|")[1] ELSE "No Data"

//{@SplitonBar02}
IF [Ubound(Split({table.A1},"|"))]>1 THEN
Split({table.A1},"|")[2] ELSE "No Data"

//{@SplitonBar03}
IF [Ubound(Split({table.A1},"|"))]>2 THEN
Split({table.A1},"|")[3] ELSE "No Data"

//{@SplitonBar04}
IF [Ubound(Split({table.A1},"|"))]>3 THEN
Split({table.A1},"|")[4] ELSE "No Data"

I do not have crystal in front of me, so apologize in advance for any typos &/or errors in logic or syntax.
 
But the values are not limited to 4, it could be anywhere from 1 through 10 or 15.
 
if you want each value as it's own 'field' for display, i think you will have to use a formula for each possible value (so if there could be 15 |-separated values then there would be 15 formulas) to be returned along with suppression logic to 'hide' the empty ones.
 
Hi ReportDr00

You could replace the pipe character with a line feed (or carriage return) which would have the effect of splitting each component to a separate line. Create a formula like this:

Replace({table.field}, '|', Chr(13))

and then format the formula to Can Grow.

The problem with this approach is that, if you are exporting to excel it won't create a row per line, but otherwise it should work. Otherwise, I think the only option will be as suggested by fisheromacse, where you will need to cater for the maximum number of lines expected.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top