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

ARRAY

Status
Not open for further replies.

Farheen

Programmer
Oct 27, 2003
3
PK
how can i print an array element in different rows

 
You could use the recordnumber field to index your array.

In a formula that would reside in your detail section:
Code:
WhilePrintingRecords;
stringVar array myArray;
myArray[recordnumber]

This would work as long of your array was created and Initialized before the detail section. This would also assume that there are at least as many array elements as the number of records returned. You may need to put in some logic to ensure that the recordnumber is not greater than the upper bound of the array.

Code:
WhilePrintingRecords;
stringVar array myArray;

if recordnumber <= UBound(myArray) then
    myArray[recordnumber]
else
    &quot;UNKNOWN&quot;;

~Brian
 
This will print an array in it's entirety with each element in a different row.

join(MYaRRAY,chr(13))

May not work as you supplied nothing about your environment, whether this is a CR array or within a table - if you need technical help, try postinjg technical information, such as versioning, example data and expected output.

-k
 
I have a comma separated Value in a table What i do to read all comma separated values and print it all in different rows I think now you clearly understand what i did I wrote a function i.e.
NumberVar i :=0;
Stringvar a :=&quot;&quot;;
stringVar array a1 := split({Command.ADMINTIMINGS},&quot;,&quot;);

for i := 1 to ubound(a1) do
(a := a & a1 );
a
but it print all in one row
 
Try this:

NumberVar i :=0;
Stringvar a :=&quot;&quot;;
stringVar array a1 := split({Command.ADMINTIMINGS},&quot;,&quot;);

for i := 1 to ubound(a1) do
(a := a & a1 & chr(13));
a

~Brian
 
In my last post, the subscript was missing due to the TGML.
It should have been:
Code:
NumberVar i :=0;
Stringvar a :=&quot;&quot;;
stringVar array a1 := split({Command.ADMINTIMINGS},&quot;,&quot;);

for i := 1 to ubound(a1) do 
(a := a & a1[i] & chr(13));
a

If you want to streamline the code just use this one line:
Code:
Replace({Command.ADMINTIMINGS},&quot;,&quot;,chr(13));

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top