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

Array Parameter 2

Status
Not open for further replies.

Thanhly

Programmer
Jul 8, 2004
9
0
0
CA
Hi There,

I have a question for the crystal array parameter, here is
what is my situation

I Create a report with two parameters called "pRegion" and "pDistrict"
and define its as follow:

1. Type String,
2. Allow Mutiple values (Option Selected)
3 Discrete value(s) (Option Selected)

and from the Record selection formula I define as follow:

(ToText({Table.Region}) = {?pRegion}) AND
(Totext({EMeterInsp.ContribDist}) = {?pDistrict}

when I run the report from crystal tool,let say I selected
multiple region code pRegion = "1,3,5" and multiple District = "45,67,89" The report fine, it display all the region and district I selected.

BUT where the report was call from Progress application the "pRegion" parameter is 1,3,5 and the district is 45,67,89 but the report display no record. Then I try to re-run from the application
with a single region "1" and District "45" but the report still give me no record.

Any ideas or suggestions would be greatly appreciated.

Thanks..

 
Thanhly,

Had the same problem. To get the report to run outside of Crystal:
Try removing the option "Allow Multiple values" from the parameter.
Then edit the Record Selection to:
(ToText({Table.Region}) in {?pRegion}) AND
(Totext({EMeterInsp.ContribDist}) in {?pDistrict}


Rerun using the format you were using seperating multiple value with a comma.
 
campsys,

Thanks for you reply. I did try remove "Allow multiple values" toggle on/off and in record selection formula I try =,in,like operator but it still does not work.

I am not sure what Crystal expect the parameter passing as

Case 1: 1,3,5 character string or

Case 2: '1','3','5' character string or

Case 3: "1", "3","5" character string


My current parameter received is case 1: 1,3,5 character string.

Thanks.

 
Thanhly,

If the fields {Table.Region} and {EMeterInsp.ContribDist} are numbers then try editing both the parameter "value type" to number instead of string.

Then try this in the Record Selection. It will allow for either parameter, or both parameters to be blank.


(IF TRIM({?pRegion}) <> "" Then
{Table.Region}) in {?pRegion}
Else True)
AND
(IF TRIM({?pDistrict}) <> "" Then
{EMeterInsp.ContribDist} in {?pDistrict}
Else True)











(ToText({Table.Region}) in {?pRegion}) AND
(Totext({EMeterInsp.ContribDist}) in {?pDistrict}


 
You need to use :

(ToText({Table.Region},0,"") = {?pRegion}) AND
(Totext({EMeterInsp.ContribDist},0,"") = {?pDistrict}

When you convert a number to text by using ToText(1) the default result is 1.00

By using ToText(1,0) this will produce the rsult to 1 decimal place, i.e. 1

The "" removes any thousand separator, e.g
ToText(1000) = 1,000.00
ToText(1000,0) = 1,000
ToText(1000,0,"") = 1000

Hope this helps...

Reebo
 
Thanks for both of you Campsys & Reebo99.

I am using
(ToText({Table.Region},0,"")= {?pRegion}) AND
(ToText({Table.Contridist},0,"")= {?pDistrict})

It work.

The thing I concern it since I am using Totext function to convert Numeric field into Text. It is running slow:

These Parameters passing from outside Crystal is String and I try to convert it to using To Number as follow:

{Table.Region} = Tonumber({?pRegion}) AND
{Table.Contridist} = Tonumber({?pDistrict})

and I received the error message:

" This array must be subscripted. For example:Array"

Is there any way to work arround it?

Thanks...
 
make your parameters numbers and not strings to begin with

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Thanks for all of your, I just find out the way to convert the numeric string array into integer array. and It work.
Here is the codes:

(IF TRIM({?pRegion}[1]) <> "" THEN
( numbervar lRegion:= count({?pRegion});
numbervar lCounter;
numbervar array RegionArray:= [0];
redim RegionArray[1000];
for lCounter:= 1 to lRegion step 1 do
RegionArray[lCounter] := tonumber({?pRegion}[lCounter]);
{Table.PertainReg} = RegionArray
)
ELSE
True
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top