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

Parameter(s) in report header 3

Status
Not open for further replies.

gboo19

Technical User
Sep 13, 2005
5
US
I have written a report in CRXI that uses a numeric parameter field named {?Priority}. The {?Priority} field is used for record selection and can be either a discreet value, multiple values, or a range. I want to add the actual values chosen as part of the page header. I have tried using the For Loop below to add this info to the page header, but get the error listed below. Any help would be appreciated. The for loop I am using is:

NumberVar Counter;
StringVar Message := "Priorities Chosen: ";

// cycle through all members of the multivalue
For Counter := 1 to Count({?Priority}) Step 1 Do
(
// build the Message varable, along with coma/space
Message := Message & {?Priority}[Counter] + ", "
);

// strip off last comma/space added to the loop
Left(Message, Length(Message) - 2)

When I try to save, I get an error in the following line:
Message := Message & {?Priority}[Counter] + ", "

The error highlights {?Priority}[Counter] and states "A number, currency amount, date, time, date-time, or string is required here."

 
Hi,
If a multivalue parameter then it is an array, so use Crystal's array processing to create your string of delimited values. Try:

Code:
@MyHeaderMessage
"Priorities Chosen: " + Join({?Parameter},",")





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks Turkbear, but when I insert the appropriate variable in your formula fo {?Parameter}, it gives me an error stating that the parameter must be a string. The actual parameter is a numeric parameter, not a string.
 
Hi,
I wondered is that might be a problem, so try:
Code:
@MyHeaderMessage
"Priorities Chosen: " + Join(ToText({?Parameter}),",")

BTW, your original method would have the same problem, if it had gotten that far.





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
In case the JOIN operator does not like a numeric array ( and it may not), then you will need to parse the numbers and convert them to a string,like in your first attempt, something like:
Code:
@MyHeaderMsg
NumberVar Limit := UBound({?Parameter});
Numbervar Indx ;
StringVar Msg :=  "Priorities Chosen: " ;

For Indx For i := 1 To Limit Do
(
  local StringVar Txt := ToText({?Parameter}[i]);
   Txt := Txt + ","
);
Msg := Msg + Txt;
Msg   [COLOR=green] //may be optional[/color]

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks again. First suggestion, still a no go due to my variable being numeric.

Second suggestion gives an error in the line:
"For Indx For i := 1 To Limit Do".

Errors on 2nd "For" saying "an assignment is expected here."

 
Hi,
TYPO ( Big time) when cutting and pasting, try:
Code:
MyHeaderMsg
NumberVar Limit := UBound({?Parameter});
Numbervar Indx ;
StringVar Msg :=  "Priorities Chosen: " ;

For Indx := 1 To Limit Do
(
  local StringVar Txt := ToText({?Parameter}[Indx]);
   Txt := Txt + ","
);
Msg := Msg + Txt;
Msg   [COLOR=green] //may be optional[/color]

[profile]
[COLOR=blue]
To Paraphrase:"The Help you get is proportional to the Help you give.."
[/color]
 
Well, that solved the previous error, now with the new wording, I get a different error. In the line

local StringVar Txt := ToText({?Parameter}[Indx]);

I change the "{?Parameter}[Indx] to "{?Priority}[Indx]"
({?Priority} is the actual name of the parameter field. The error then highlights "{?Priority}[Indx]" and gives the error "A number, currency amount, boleen, date, time, date-time, or string is required here."

Any other ideas?
 
Hi,
How is the parameter defined?
Try this formula:

@testParamValue
{?Priority}[1]

See if it fails...

Be sure the parameter is defined as 'allow multiple values'
and, as a first test, just 'Discrete Values' - try a second time with 'Range of values'



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
There is an faq on this topic: faq767-5684 that might help.

-LB
 
Turkbear & lbass,

Thanks for your assistance. Found the problem. The problem was the range. Once I changed the parameter to just a discreet, multi-variable variable, all works fine. It was the "range" variable that was causing the problem. Can do without the range, so all works fine now.

Tanks again!
 
Hi,
Look at LB's excellent reference...It details how handle range values ( even muliple ranges) - the section on Numeric parameters contains methods of determining if the parameter is a range or not and decodes accordingly.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top