?
Solved

Shared Variables

Posted on 2007-07-19
10
Medium Priority
?
368 Views
Last Modified: 2008-01-09
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
Comment
Question by:vbjohn
  • 5
  • 5
10 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 19525333
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
 

Author Comment

by:vbjohn
ID: 19531011
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
 
LVL 42

Expert Comment

by:frodoman
ID: 19532795
I would start by displaying the value of nbrCtGt to make sure it isn't '1'...

0
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 

Author Comment

by:vbjohn
ID: 19532957
It comes out to be 9.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 19532970
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
 

Author Comment

by:vbjohn
ID: 19533575
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
 
LVL 42

Expert Comment

by:frodoman
ID: 19533604
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
 

Author Comment

by:vbjohn
ID: 19533713
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
 
LVL 42

Accepted Solution

by:
frodoman earned 260 total points
ID: 19533786
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
 

Author Comment

by:vbjohn
ID: 19533955
You saved my job!  Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question