Joined: 31 Mar 2009
Location: United Kingdom
Online Status: Offline
Posts: 10
Topic: StringVar "Others" on first value Posted: 13 May 2009 at 2:04am
Hi all,
I am quite new to CR and I'm having a issue where my string variable is returning "others" on certain fields where WK1 = 0 and I can't work out why? PLease see code below
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 13 May 2009 at 6:53am
I don't see it, but what I would do is list all of the table fields on the same line as the formula, or create a new section and list them there, to see if there hole in your formula/what the cases look like that are causing the incorrect answer to be displayed.
Joined: 31 Mar 2009
Location: United Kingdom
Online Status: Offline
Posts: 10
Posted: 13 May 2009 at 8:19am
local stringVar s:="" ;
if {DB.SO_ODD}=1 and {DB.SO_EVEN} = 0 then "Fortnightly ODD"
else if {DB.SO_ODD}=0 and {DB.SO_EVEN} = 1 then "Fortnightly Even"
else if {DB.SO_ODD}=1 and {DB.SO_EVEN} = 1 and {DB.SO_WK1}=1 and {DB.SO_WK2}=1 and {DB.SO_WK3}=1 and {DB.SO_WK4}=1 and {DB.SO_WK5}=1 then "Weekly"
else ( if {DB.SO_WK1}=1 then s:= "W1 "; if {DB.SO_WK2}=1 then s:= s & "W2 "; if {DB.SO_WK3}=1 then s:= s & "W3 "; if {DB.SO_WK4}=1 then s:= s & "W4 "; if {DB.SO_WK5}=1 then s:= s & "W5 "; s )
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 13 May 2009 at 9:11am
I think that the part that is confusing is that it says "Others", which isn't an option.
By chance is there another variable called s in the report? Maybe it isn't local scope. I would try changing the variable name maybe ss or sWeekly. I would also try moving where s is displayed, that might give an idea of what's going on.
I would give that a try, if the results are the same, I am at a loss, as the formula looks spot on.
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