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

CR X1, array is not returning all the values of my parameter

Status
Not open for further replies.

Oscar115

Technical User
May 21, 2010
30
US
I am using CR XI. I have a parameter AMP defined which can have multiple values. At the current time to test my array set up, my values for the AMP parameter are: 501, 502, and 510 (in this order)
.
ubound{?AMP} within the array formula is returning the correct value of 3.

However my array is only returning one value, the last, 510.
I have defined the formula Fund Number which looks like the following:

whilereadingrecords;
numbervar i;
numbervar j := ubound({?AMP});
stringvar array fundnumber;
stringvar k := '';
for i :=1 to j do(
redim preserve fundnumber[j];
fundnumber:={?AMP};
k:= fundnumber
);
k

I have placed the formula Fund Number in GH1 area of the report.
The fund number value will be used to select financial accounts.
I have completed the report for one account number but have been asked to modify it for multiple account numbers, thus the array.

Any suggestions would be appreciated.

Thanks,
Oscar115
 
You should be going to report->selection formula->record and entering:

{table.fundnumber} = {?AMP}

Then to display the selected parameter values, create a formula like this in the field explorer->formula->new:

join({?AMP},", ")

Place this in the report header.

You can't group on a parameter. You should be grouping on {table.fundnumber}, assuming you are looking at accounts within each fundnumber.

-LB
 
Hello LB,
This is my selection formula as the fund number is only the beginning part of each account I need to work with.

not ({@Account #} in ["480000", "759000"]) and
{glacct.cacctid} like (totext({@Fund Number})+"*") and
{glcatg.ccatgtype} like ["*Expense*", "*Other Revenue*", "*Revenue*"]

Thanks,
Oscar115

 
You need to show the contents of the formula where you are referencing the fundnumber and explain how you are using it.

-LB
 
Hello LB,
The formula 'Fund Number' was given initially. 'fundnumber' is the name of my array.

Let me know if this is not what you were wanting to reference.

Thanks,
Oscar115
 
What is the purpose of your parameter? Please show the formula in which it is being used to do something in your report. Creating a parameter and only displaying its results makes no sense. The point of a parameter is to limit something in the report.

However, if you just want to display values for no reason, you can still use my earlier formula:

join({?AMP},", ")

Your formula is designed to return only one value in the array.

-LB
 
My selection criteria for the report is as follows:
not ({@Account #} in ["480000", "759000"]) and
{glacct.cacctid} like (totext({@Fund Number})+"*") and
{glcatg.ccatgtype} like ["*Expense*", "*Other Revenue*", "*Revenue*"]

My intention with the array is to compare each value of fundnumber array to the account id and select only those records that start with each of the values of the array.

Thanks,
Oscar115
 
Okay, now I see. Try this as your record selection formula:

whilereadingrecords;
numbervar i;
numbervar j := ubound({?AMP});
stringvar x;
for i := 1 to j do(
if {glacct.cacctid} like {?AMP}+"*" and
not({glacct.cacctid} in x) then
x := x + {glacct.cacctid} + ", ");
{glacct.cacctid} in x and
not ({@Account #} in ["480000", "759000"]) and
{glcatg.ccatgtype} like ["*Expense*", "*Other Revenue*", "*Revenue*"]

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top