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

Question about populating Array with Data 1

Status
Not open for further replies.
Feb 25, 2004
79
US
Hello, I have a question about arrays and I am not sure that it has been addressed exactly. My apologies if it has.

Using CR 10 and Pervasive SQL Backend

I have 2 Groups on the report Category and Item.

My goal is to make multiple item's quantities on a single line.

I think I need to populate an array from the database within a group (item).

I do not know how I would go about creating the array that pulls only data from each group.

Any help is appreciated!!!

Thanks,
Rob
 
Please show a sample of how you want your report to look.

-LB
 
Hey Lbass,

For each line item (which will look identical in the report) I need to have those individual quantities displayed on a single line not summarized but just listed horizontally.

Example before Array:

item qty
2x4 12"
2x4 12"
2x4 12"
2x4 16"
2x4 16"
2x4 18"
2x6 22"
2x6 22"


Desired:

item qty
2x4 12" x 3, 16" x 2, 18" x 1
2x6 22" x 1


Hope this makes sense. Thanks!

 
Insert groups in this order: category, item, qty. Drag the item group name into the Group #2 footer. Then create these formulas:

//{@reset} to be placed in GH2 (item):
whileprintingrecords;
stringvar displ := "";

//{@accum} to be placed in GH#3 (qty):
whileprintingrecords;
stringvar displ;
displ := displ + {table.qty} + " x " + totext(count({table.qty},{table.qty}),0,"") + ", ";

//{@display} to be placed in GF#2 (item):
whileprintingrecords;
stringvar displ;
left(displ, len(displ)-2)

Suppress the GH#2, GH#3, details, GF#3. I assumed that {table.qty} was a string, but if it isn't, use:
whileprintingrecords;
stringvar displ;
displ := displ + totext({table.qty},0,"")
+ " x " + totext(count({table.qty},{table.qty}),0,"") + ", ";

-LB
 
As always, you rock!

Give me a few days to try it, I am excited to see it in action.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top