Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: building a string Post Reply Post New Topic
Page  of 2 Next >>
Author Message
computermike
Newbie
Newbie


Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
Quote computermike Replybullet 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 {?@BidStatus} = "" or  isnull({?@BidStatus})
    then MyString := "Bid Status: All" & "     "
    else MyString := "Bid Status: " & {?@BidStatus} & "     ";
 
if {?@BidResult} = ""  or  isnull({?@BidResult})
    then MyString := MyString & "Bid Result: All" & "     "
    else MyString := MyString &  "Bid Result: " & {?@BidResult} & "     ";
if {?@ProjectType} = ""  or  isnull({?@ProjectType})
    then MyString := MyString & "Project Type: All" & "     "
    else MyString := MyString &  "Project Type: " & {?@ProjectType} & "     ";

if {?@PrimeSub} = ''  or  isnull({?@PrimeSub})
    then MyString := MyString & "Prime or Sub: Both" & "     "
    else MyString := MyString &  "Prime or Sub: " & {?@PrimeSub} & "     ";
MyString
 
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 09 Apr 2010 at 8:12am
What is it not doing?
IP IP Logged
computermike
Newbie
Newbie


Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
Quote computermike Replybullet 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 IP Logged
computermike
Newbie
Newbie


Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
Quote computermike Replybullet 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 IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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 IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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 IP Logged
computermike
Newbie
Newbie


Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
Quote computermike Replybullet 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 IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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 IP Logged
computermike
Newbie
Newbie


Joined: 02 Sep 2008
Location: United States
Online Status: Offline
Posts: 14
Quote computermike Replybullet 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 IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet 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 IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.035 seconds.