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

Column Fomatting

Status
Not open for further replies.

psamedy

Technical User
Apr 22, 2002
60
US
I'm trying to implement the Replicatestring function in my formula, but have not been successful. I'd like to make the data that is returned to look like they are in column format and return to the next line after the third "column". The built in column formatting option available in the detail section will not work for me. Presently, my data is being returned in somewhat of a column format but i need the columns to line up correctly - straight. This is being used in the body of a form letter, and the variable is reset int the group header. After multiple posts the formula bellow is the closest i've been. Any help or any new ideas would be appreciated.

WhileprintingRecords;
StringVar Item := {provider.ppo_description};
StringVar Chain;
NumberVar ChCnt:=ChCnt+1;

if length(Chain) + Length(Item) > 254
then Chain := Chain
else if chcnt/3 = int(chcnt/3) then
Chain := chain+', '+Item+chr(13)
else if chcnt/3 <> int(chcnt/3) then
Chain := chain+' '+Item

This an exampe of what my data looks like:

ID Name Addr1 State ppo_description
-- ---- ----- ----- ----------------
01 Pat Ave A NY Local 2
01 Pat Ave A NY Local 4
01 Pat Ave A NY Local 5
03 Jane Ave B NY Local 1
03 Jane Ave B NY Local 15
02 Carl Ave J PA Local 7

I'd Like it to look like this in the form letter:

Local 2 Local 5 Local 7
Local 4 Local 15 Local 9
Local 1 Local 14 Local 3
 
I'm getting a message that reads:
A subscript must be between 1 and the size of the array.

And it directs me to the @CollectLocals fromula:

WhilePrintingRecords;

StringVar array Locals ;
NumberVar Pointer ;

Pointer := Pointer + 1;
Locals[Pointer] :={ppo.description}

Any suggestions?

Thanks Pat
 
this means that the Array has not been initialized properly.

DID YOU PUT THIS FORMULA IN THE PROPER PLACE???

*********
In the Group 1 header you place the initialization formula

@initialization (supressed)

WhilePrintingRecords;

if not inRepeatedGroupHeader then
(
//initialize to 50% more locals than you expect to see for one ID
StringVar array Locals := [&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,....&quot;&quot;,&quot;&quot;];
NumberVar Pointer := 0;
);

***********

It can also mean that you did not initialize the proper number of array elements...REMEMBER Estimate the number of Locals you will get maximum in a report then add 50% to that

eg:
If you estimate 10 locals then initialize for 15
StringVar array Locals := [&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;];



Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top