Crystal Reports

In Crystal Reports, i'm trying to take an entry in a database table and split it into multiple cells. I've successfully used split() to break the data into an array, but how do I stretch it to independent entries? Can I take individual parts of the array and link it to another table?

Example data:
RABCDEF  RGHIJKL  RMNOPQR

All are separated by a space. I used split({table.column}," ")  and then what else?
LVL 4
HackLifeAsked:
Who is Participating?
 
JamesPMCDCommented:
If its only three char then its easier. Use a loop to go through and divided each item into an array

Local StringVar array x := ["a","b"]; // or SHARED

redim x [(table:column1)/3)]

for i := 1 to len(table:column1) Step 3 Do
(
  x[i] := mid(table:column1,i,i+3)

);

The the array can be used to linke to another table or sub report.

0
 
JamesPMCDCommented:
Here's one I just used.

I have a string field that stores a set of data extracted from a table as one string.
I have a set of three sub string I used to determin what position the breaks will be at and then I extact it into variables that I display through functions.

You could uses the same routine looking for the spaces.

'*******************************************************
NumberVar xPos;
NumberVar xPosD;
NumberVar xPosS;

SHARED StringVar xDesc;
SHARED StringVar xSerial;

xPos := instr(1,{fil_MRPOverRides.rsFields},"Desc :",1);
xPosD := instr(1,{fil_MRPOverRides.rsFields},"rowID :",1);
xPosS := instr(1,{fil_MRPOverRides.rsFields},"Serial :",1);

if xPosS > 0 then
    (
    xSerial := "  " & replace(mid({fil_MRPOverRides.rsFields},xPosS, len({fil_MRPOverRides.rsFields})),"serial : ","");

    xSerial := mid(left(trim(xSerial),len(trim(xSerial)) -1),5) ;

    if xPos > 0 then
        (   xDesc := replace(mid({fil_MRPOverRides.rsFields},xPos,XPosD - xpos-1),"Desc : ","") ;
        );

    trim(replace(xDesc,xSerial,""))  
    )
else
"";
'*************************************************************************
0
 
HackLifeAuthor Commented:
Here's another example of what I'm trying to do:

table1:column1

abc def
abc def ghe
ghe
abc
abc ghe


table2:column1

abc me@me.com
def me2@me2.com
ghe me3@me3.com


I need to get the emails in table2 linked to each 3 letter indicator in table 1. The problem is that table 1 contains a bunch lumped into one cell.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
HackLifeAuthor Commented:
how do you link?
0
 
JamesPMCDCommented:
That a little more fun.

Running this array in a sub report you can create a table. then link back to the main report using the formula
0
 
HackLifeAuthor Commented:
Interesting... i'll have to give it a try. thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.