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!

muliple parameters showing in report

Status
Not open for further replies.

pcdork

Technical User
May 10, 2005
7
US
I have CR 7.5 running on server 2000 with SQL 2000.
when scheduling the report you have a choice of picking 1,2,3 or all locations. this part works fine but now the boss wants to be able to see which yards that he picked in the report. i wrote a formula to do this but it is not working right. if i select 1 location and have the count =1 location first in the formula then it works but if i select 2 or more yards then it does not work. if i select 2 yards and put the count = 2 first in the formula then it works. i have include part of the formula that i am using. I know just the basics on writing fomula and any help I would be great full. thank you

If count ({?YardID}) > 3 then
"All Yards"
else

If count ({?YardID}) = 1 then
If {?YardID} = 1 then
"home"
else

If {?YardID} = 2 then
"away"
else

If {?YardID} = 3 then
"here"
else

If {?YardID} = 7 then
"there"
else

If count ({?YardID}) = 2 then
If {?YardID} = 1 then
If {?YardID} = 3 then
"home and here"
else

If count ({?YardID}) = 2 then
If {?YardID} = 1 then
If {?YardID} = 2 then
"home and away"
else

If count ({?YardID}) = 2 then
If {?YardID} = 1 then
If {?YardID} = 7 then
"home and there"
else

If count ({?YardID}) = 2 then
If {?YardID} = 2 then
If {?YardID} = 3 then
"no where"
else

If count ({?YardID}) = 2 then
If {?YardID} = 2 then
If {?YardID} = 7 then
"everywhere"
else

If count ({?YardID}) = 2 then
If {?YardID} = 3 then
If {?YardID} = 7 then
"close to home"
else

If count({?YardID}) = 3 then
If {?YardID} = 1 then
If {?YardID} = 2 then
If {?YardID} = 3 then
"all but here"
else

If count({?YardID}) = 3 then
If {?YardID} = 1 then
If {?YardID} = 2 then
If {?YardID} = 7 then
"all but there"
else

If count({?YardID}) = 3 then
If {?YardID} = 1 then
If {?YardID} = 3 then
If {?YardID} = 7 then
"far far away"
else
 
Here's the whitepaper:


Basically the modified formula for numerics would be:

numbervar counter;
stringvar holder;
counter := count({?Multi});
//The above formula line retrieves the number of elements in the array.
while counter > 0 do
(holder := holder + totext({?Multi}[counter],0,"") + ',';
counter := counter - 1);
holder [1 to (length(holder)-1)]
//The above formula line removes the trailing ',' from the string.

-k
 
Thank you for the help but now I am getting an error that reads "the remaining text does not look to be part of the formula" and edit line blinks right before line "while counter > 0 do"

I wish that I knew more about this but please bear with me on this.

Thank you
 
OK I did get it to work but it is using the parameter numbers instead of the name. I am going to see if i can tackle that now but if you can help me out on this i just might need it.
below is the formula that i did.

If Count({?YardID}) = 1 then
ToText({?YardID}[1])
Else If Count({?YardID}) = 2 Then
ToText({?YardID}[1]) + ", " + ToText({?yardID}[2])
Else If Count({?YardID}) = 3 Then
ToText({?YardID}[1]) + ", " + ToText({?YardID}[2]) + ", " + ToText({?YardID}[3])
Else If Count({?YardID}) = 4 Then
ToText({?YardID}[1]) + ", " + ToText({?YardID}[2]) + ", " + ToText({?YardID}[3]) + ", " + ToText({?YardID}[4])

thank you
 
I posted an entirely different formula, and asked that you show what you tried, which you didn't do.

How am I supposed to help someone who says the cursor is blinking instead of showing what they tried?

In IT, describing a problem rarely conveys it as well as real examples, such as the code you used.

Anyway, if it ain't broke, don't fix it ;)

In other words, if you're getting the desired results, then what does it matter?

-k
 
No I completly understand and I will post the code that I started with tomorrow or if I remote into my computer tonight I will have it posted tonight. But if it was not for you I would not have come up with what I did, you gave me a new line of thinking and your whitepaper is very good.
 
You should be able to use a formula like:

stringvar parmdesc := "";
numbervar counter := 0;
numbervar i := ubound({?YardID});

if ubound({?YardID}) > 3 then
parmdesc := "All" else (
for counter := 1 to i do(
parmdesc := parmdesc + (
if {?YardID}[counter] = 1 then "Home" else
if {?YardID}[counter] = 2 then "Away" else
if {?YardID}[counter] = 3 then "Here" else
if {?YardID}[counter] = 7 then "There" else
"")+ ", ");
left(parmdesc, len(parmdesc)-2));

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top