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!

Need data to be passed in an Array 1

Status
Not open for further replies.

varadha72

Programmer
Oct 14, 2010
82
US
Hi,
I have the following report structure.

Detail Section: Field Names with Data are-
Name ID Holidays
A 1 1/1/2014
A 1 1/2/2014
A 1 1/7/2014
B 2 1/2/2014
C 3 1/2/2014
C 3 1/5/2014

In Detail-B section I have an @Array
@Array - Formula
WhilePrintingrecords
Numbervar Count;
Count+Count+1;

I Tried inserting a formula in the detail section with @ArrayOutPut reading;
if @Array=1, then "("+[Name]+","+[ID]+","+[Holidays], but the result is not returning as expected below.

EXPECTED OUTPUT- I need another array (@ArrayOutPut) to display the following data in following pattern-
@ArrayOutPut-
(A, 1, 1/1/2014, 1/2/2014, 1/7/2014)
(B, 2, 1/2/2014)
(C, 3, 1/2/2014, 1/5/2014)

I am not sure how to proceed further, please help or share any link for the support.
 
A detail section only has the data for one record, it looks like you could put all of this in the report footer by creating 3 formulas to build output strings
They would look something like this:

shared stringvar idA :=' ';
shared stringvar showA := '' ;
if [table.name} = 'A'
then (showA:=showA+totext({table.holiday},"MM/dd/yyyy")&", ";idA:={table.id})
else (showA:=showA;idA:=idA)

the create similar formulas for B and C
put these formulas in the detail band, and suppress it (or suppress them if you need to show other things)

In the Report footer you would have A, B, and C formulas like this:
shared stringvar idA;
shared stringvar showA;
local stringvar trimA := left(showA,(len(showa)-2) // this is to get rid of the last ", " at the end of the string
"A, "&idA&", "&trimA
 
Thanks Charliy,

But the requirement is to display A, B, C sequentially in the @ArrayOutPut for all Names. Which means I need only one formula is report footer to display all the values for A in one line with dates, then second line for B and subsequently for C and thereon.
The purpose is to export this to Excel and also that the name field can vary.

Please suggest.
 
Also please suggest if I could create a Group on the Field [Name] and create this formula in Group footer, will this be of any help, let me try.
 
Creating a group on ID should be better. Sort on ascending order of Holidays.

I believe the following formulas should give you the desired output :

@init
[tt]whileprintingrecords;
stringvar Holidays:="";
stringvar finaloutput;[/tt]
Place it in Group Header.

@Holidays
[tt]whileprintingrecords;
stringvar Holidays;
Holidays:=Holidays+", "+ totext({Table.Holidays});
Holidays;[/tt]
Place it in Details.

@DispHolidays
[tt]WhilePrintingRecords;
stringvar Holidays;
Holidays;[/tt]
Place it in Group Footer.

@FinalOutput
[tt]WhilePrintingRecords;
stringvar finaloutput:="";
finaloutput:=finaloutput+" " +{Table.Name}+", " +totext({Table.ID})+" "+{@dispHolidays}[/tt]

(If you need the parenthesis also as shown in your first post you can use
[tt]finaloutput:="("+finaloutput+" " +{Table.Name}+", " +totext({TableID})+" "+{@dispHolidays}+")"[/tt]
instead)
Place it in Group Footer.

Suppress @dispHolidays, Group Header and Details.









 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top