Author |
Message |
computermike
Newbie
Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
|
Topic: building a string Posted: 09 Apr 2010 at 7:17am |
I am trying to build a string using a variable and if statements, but nothing gets returned.
Can' get this to work. Anyone see why???
local Stringvar MyString;
if {?@PrimeSub} = '' or isnull( {?@PrimeSub}) then MyString := MyString & "Prime or Sub: Both" & " " else MyString := MyString & "Prime or Sub: " & {?@PrimeSub} & " ";
MyString
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 09 Apr 2010 at 8:12am |
What is it not doing?
|
IP Logged |
|
computermike
Newbie
Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
|
Posted: 09 Apr 2010 at 8:50am |
It returns nothing. I think it is my parameter. I use it in the formula., then my formula is in the PageHeader section
|
IP Logged |
|
computermike
Newbie
Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
|
Posted: 09 Apr 2010 at 8:56am |
Yes, it works if I use a database field, but if I use param it returns nothing.
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 09 Apr 2010 at 9:13am |
I was wondering about that myself. I would have to do some testing to see what I get.
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 09 Apr 2010 at 9:20am |
I tried a quick test. But then again, I do not know how you are using the parameters. Are they in the select expert or just in the report? If they are in the select expert what comparison are you using (equal, not equal, etc.). Is the parameter set up for one value, multiple values, a range?
|
IP Logged |
|
computermike
Newbie
Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
|
Posted: 09 Apr 2010 at 10:17am |
I have a stored procedure I pass the params to, so they are not in select expert. The only place I use them is on the Page header so the report user can see the params they entered. If they leave blank it returns all data, but this is coded in stored procedure
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 09 Apr 2010 at 10:30am |
I added a second if (I know you had four, but start simple). I am getting curious result. I think there may be an logic error with the if's.
|
IP Logged |
|
computermike
Newbie
Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
|
Posted: 09 Apr 2010 at 10:34am |
I just gave up and created four seperate formulas. I use almost exact same code, just broke into f4 formulas, don't use variable either.
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|
Posted: 09 Apr 2010 at 10:45am |
I miss copied the formula. It is working for me. You might want to check for nulls first in each if. CR is funny about that. But then again, I am not using a stored procedure for the input.
Lots of luck.
|
IP Logged |
|
|