• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

Shared Variables

I have this in the Page Header:

WhilePrintingRecords;
Shared stringVar strChar1;
Shared stringVar strMethod1 := "";
Shared stringVar strFreq1 := "";
Shared numberVar nbrCount := 1;
Shared numberVar nbrCtGt := 1;

//nbrCtGt := Count ({AKA.CUST_ITEMNO});
nbrCtGt := 7;
Local NumberVar i;
For nbrCount := nbrCtGt To 1 Step 1 Do
(
   strChar1 := {SPC_DIMENSION.DIMENSION}
);
strChar1

and this in the Group Header:

Shared stringVar strChar1;
strChar1

What am I missing?  I can not remember on how to get this done.

thanks.
0
vbjohn
Asked:
vbjohn
  • 5
  • 5
1 Solution
 
frodomanCommented:
Don't know what you're trying to do so I can't tell you how to do it.  I can say that if you want to loop from 7 to 1, you need to make your "STEP" equal to negative 1 (-1) instead of to 1...
0
 
vbjohnAuthor Commented:
ok.  Maybe this will help out better...  It is working now.  But, I am trying to use an array...
frmChar1 - gets the data...
frmChar2 - gets nothing...

any ideas?

frmMain: (Page Header)
Shared stringVar Array strChar;
Shared stringVar strMethod1;
Shared stringVar strFreq1;
Shared numberVar nbrCount;
Shared numberVar nbrCtGt;


frmFormula: (Group Header)
WhilePrintingRecords;
Shared stringVar Array strChar;
Shared stringVar strMethod1;
Shared stringVar strFreq1;
Shared numberVar nbrInProHigh1;
Shared numberVar nbrInProLow1;

Shared numberVar nbrCtGt;
Local NumberVar i;
Redim strChar[10];

nbrCtGt := Count ({ARINVT.ITEMNO}, {ARINVT.ITEMNO});

For i := 1 To nbrCtGt Step 1 do
(
    strChar[i] := {SPC_DIMENSION.DIMENSION};
    strMethod1 := {SPC_DIMENSION.DESCRIP};
    strFreq1 := {SPC_DIMENSION.SPECIALNOTE};
    nbrInProHigh1 := {SPC_DIMENSION.USL};
    nbrInProLow1 := {SPC_DIMENSION.LSL};
)


frmChar1: (Group Footer)
shared stringVar array strChar;
strChar[1]

frmChar2: (Group Footer)
shared stringVar array strChar;
strChar[2]
0
 
frodomanCommented:
I would start by displaying the value of nbrCtGt to make sure it isn't '1'...

0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
vbjohnAuthor Commented:
It comes out to be 9.
0
 
frodomanCommented:
Okay, add this to the end of your group header formula:

'[' + strChar[1] + '/' + strChar[2] _ ']';

This should show you what is going into those elements within the formula.


0
 
vbjohnAuthor Commented:
It comes out blank.  Since it is in the Group Header.

When I put it in the Details line... I get data.  
But, I have about 6 records and what is being passed along is the last account information.
0
 
frodomanCommented:
Okay, let's back way up.  Can you tell me what you're trying to accomplish?  If you are, as I now suspect, trying to add the values from each record into the array then this must be done in the details section.
0
 
vbjohnAuthor Commented:
ok.
I am putting the results in a Group Footer:
7 Records on this example

example data:  Test1.... Test2 .... Test3 .... Test4.... Test5 .... Test6 .... Test7 ....
Output is like Row1 :  Test1.... Test2 .... Test3 .... Test4.... Test5 .... Test6 .... Test7 ....
Output is like Row2 :  RTest1.... RTest2 .... RTest3 .... RTest4.... RTest5 .... RTest6 .... RTest7 ....          

I have about 4-5 Rows

I have 2 main formula fields:
1.) Page Header (to declare the variables) (frmMain)
2.) Group Header (to get all the records that was selected)  (frmFormula)
    or should I put it in the Details section.

Then I have other formula fields...
frmChar1,frmChar2,frmChar3,frmChar4,frmChar5,frmChar6,frmChar7....
frmMeth1,frmMeth2,frmMeth3,frmMeth4,frmMeth5,frmMeth6,frmMeth7

So when I go in the FOR loop in the (frmFormula) for each record it will populate the (strChar string) that is an array.  Then it will hit the frmChar1 and print out the first Record that was entered in the strChar[1] string.

Does this make sense?  I have a screen shot of the page... but I can not figure out how to upload the image.
0
 
frodomanCommented:
Okay - I don't completely follow what you're going for, but I believe you need to put your formula in the details section to add elements to your array.  Try something more like this:

frmMain: (Page Header)
Shared stringVar Array strChar;
Shared stringVar strMethod1;
Shared stringVar strFreq1;
Shared numberVar nbrCount;
Shared numberVar nbrCtGt;
// ---- Add another variable ----
Shared numberVar OnRecordNo;

frmFormula: (Group Header)
WhilePrintingRecords;
Shared stringVar Array strChar;
Shared stringVar strMethod1;
Shared stringVar strFreq1;
Shared numberVar nbrInProHigh1;
Shared numberVar nbrInProLow1;

Shared numberVar nbrCtGt;
Local NumberVar i;
//  ---- Set array size = count of records in group  ----
Redim strChar[Count ({ARINVT.ITEMNO}, {ARINVT.ITEMNO})];
// ---- Initialize record counter variable ----
Shared numberVar OnRecordNo := 0;


// **** New Formula In DETAILS Section ****
Shared numberVar OnRecordNo;
shared stringVar array strChar;
OnRecordNo := OnRecordNo + 1;
(
    strChar[OnRecordNo] := {SPC_DIMENSION.DIMENSION};
    strMethod1 := {SPC_DIMENSION.DESCRIP};
    strFreq1 := {SPC_DIMENSION.SPECIALNOTE};
    nbrInProHigh1 := {SPC_DIMENSION.USL};
    nbrInProLow1 := {SPC_DIMENSION.LSL};
)


frmChar1: (Group Footer)
shared stringVar array strChar;
strChar[1]

frmChar2: (Group Footer)
shared stringVar array strChar;
strChar[2]

0
 
vbjohnAuthor Commented:
You saved my job!  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now