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!

Create String Array 2

Status
Not open for further replies.

ter79

IS-IT--Management
Jul 11, 2001
106
US
How can I create an array based on a data filed, the field is a string. I'm using CR 9 with data from a SQL 2K Server. I've tried looking for an answer but couldn't find one.

I would like for the array to look like. Each record could have one or more records that need to go into the array and if possible I don't want any duplicates.

John Doe, Jane Doe, James Doe

Thanks in advance
 
Not sure if this is what you mean, but you could create a formula to be placed in the detail section:

whileprintingrecords;
stringvar x;

if instr(x,{table.name}) = 0 then
x := x + {table.name} + ", ";

Then in the footer, use a display formula like:

whileprintingrecords;
stringvar x;
if len(x) > 2 then
left(x,len(x)-2)

If you want the display at a group level, you would need to add a reset formula in the group header:

whileprintingrecords;
stringvar x;
if not inrepeatedgroupheader then
x := "";

-LB
 
Post example data and the required resulting output.

lb's solution didn't use an array, and you probably don't need one. Stating architecture usually paints yourself into a corner, stating what you have and what you need will provide the best solutions.

If you need to reference them in an array, change lb's detail section formula to:

whileprintingrecords;
stringvar array x;
if instr(x,{table.name}) = 0 then
redim preserve x[ubound(x)+1];
x[ubound(x)]:={table.name};

Display would then use:

whileprintingrecords;
stringvar array x;
join(x,", ")

This also lends itself to sorting the arrays, etc. (though that's more code).

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top