Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Simplest Formula - Wrong Result Post Reply Post New Topic
Author Message
mikebird
Groupie
Groupie
Avatar

Joined: 04 Mar 2008
Location: United Kingdom
Online Status: Offline
Posts: 70
Quote mikebird Replybullet Topic: Simplest Formula - Wrong Result
     Posted: 25 Mar 2008 at 5:20am

I'm using

if {field1} = "this_string" then {field2}

to display two columns in a report seperately, which are previously showed by a single currency column with the type identified next to it by "this string". So the display method is just the other way round.

However, this simple formula comes out with £0.00 for both columns, as if the the result is boolean - true / false? Have I got the wrong syntax? I wanted the value out (field2) and can't see why that doesn't work!

When "this_string" is different things it should give relevant values. The formula is copied with various strings in there...

Thanks
IP IP Logged
philbew
Newbie
Newbie


Joined: 26 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote philbew Replybullet Posted: 25 Mar 2008 at 5:28am
Hi
 
Just a thought but are the data types of {field1} and "this_string" the same? 
IP IP Logged
mikebird
Groupie
Groupie
Avatar

Joined: 04 Mar 2008
Location: United Kingdom
Online Status: Offline
Posts: 70
Quote mikebird Replybullet Posted: 25 Mar 2008 at 5:37am

Yeah - it's a nvarchar(15) and it's got the value specified in quotes listed

I expected after the THEN, the formula would display the value in {field2} but in every row I just get 0


Thanks
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 25 Mar 2008 at 9:56am
It looks right to me...You might need to break it into pieces to debug it.

First start with verifying that field1="this string"

if {table.field1}="this string" then "match" else " "

And continue to add in pieces of the formula if this produces the right results.

Hope this helps.

Sarah
IP IP Logged
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