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

Problem using global variables

Status
Not open for further replies.

gk17

Technical User
Sep 6, 2013
86
US
I have two formulas which are used to concatenate the name and value fields. They will show all the values in their own fields separated by commas. These two fields are in my group footer #3 along with a bunch of other fields (IntID, Interval, etc.).

The issue I'm having is that if I have more than one IntID (unique) it will concatenate all my values. For example, let's say I have the following for IntID = 1 with table1.value being "1, 2, 3" For IntID = 2, table1.value will now have "1, 2, 3, 4, 5" when it should only have "4, 5". I tried resetting the the global variable table1.value (string value field) to blank by creating the formula and putting in the group header but that didn't seem to do anything.

Any help is greatly appreciated.

Thanks.
 
It sounds like the reset approach is what you need. Please post the actual formulas (reset and concatenate), and the locations (report sections) where they appear.

Cheers
Pete

 
I have 3 group headers where the first two are suppressed (used for grouping them in the order we want them in) and the third group header has most of the fields.

In the 3rd group footer, I have all the above fields from the third group header copied over. This section was created so the user can export it to an Excel file vs the PDF version which won't be in a "bare" format when exported to Excel. I have the following two formulas that are in this 3rd group footer used to concatenate the multiple values that may be contained for each unique IntID:

Code:
Global StringVar ParamNames;

if NOT (","+TRIM({table1.ParamName})+"," in ","+ParamNames+",")  then
    if ParamNames = '' then ParamNames := TRIM({table1.ParamName})
    else ParamNames := ParamNames + ", "+TRIM({table1.ParamName});
ParamNames;

Code:
Global StringVar ParamValues;

if NOT (","+TRIM({table1.ParamValues})+"," in ","+ParamValues+",")  then
    if ParamValues= '' then ParamValues := TRIM({table1.ParamValues})
    else ParamValues:= ParamValues + ", "+TRIM({table1.ParamValues});
ParamValues;

I have the following reset formula which I tried placing in any of the group headers without any success:

Code:
Global StringVar ParamNames:='';
Global StringVar ParamDBValues:='';

The end result I'm expecting is something like:

Code:
IntID     ParamNames         ParamValues 
123       RecordNum,Date     3210,01/01/2015

Thanks.
 
Don't put the reset in the group header
Create a second group footer, suppress it, and put the reset formula there.
 
I tried putting it in the second group footer (GF2) while my other fields are in the third group footer (GF3). No luck so far. The ParamNames and ParamValues are still being appended.

Thanks.
 
Not exactly what I meant.
If you want to reset after Group 2, then create a second Group 2 footer (you'll then see Group 2 Footer a and b)
Put the reset formula in Group Footer 2b, and suppress Footer b.
 
I put the reset formula in GF3b, suppressed GF3b and left my two other formulas in GF3a. Probably doing something wrong on my side. I noticed there was a mistake in the ParamDBValue name that I gave it so was hoping that by updating all my variable in the formula would do the trick. Did a refresh and no change.

Can you confirm if the formulas I'm using is accurate? Not getting any errors from them and can't find anything else wrong aside from the variable name which I corrected now.

Thanks for your continued assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top