Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula not working Post Reply Post New Topic
Author Message
Acrylon
Newbie
Newbie


Joined: 15 Jan 2009
Location: Canada
Online Status: Offline
Posts: 5
Quote Acrylon Replybullet Topic: Formula not working
    Posted: 11 Feb 2009 at 7:33am
Hi All,
 
My report lists open orders for our company, and from which locations our product is in for that order.  Said report uses the following formula:
 
if {IC65A Quantity by Location.Location code}= "  4" then
    {IC65A Quantity by Location.Qty on hand}
        else
            0
 
Basically all this does is tell the report to show the qty on hand we have for location 4.
 
The funny thing is that I can get this formula to pull the correct data in a sample report, but not in my more complex open order report.
 
I've made sure that all the linking is the same (through the visual linking expert), I'm using the exact same databases, and there is nothing in the selection expert that tells the report to exclude certain locations or items.
 
The really weird thing is that I get the correct data for some items, but not for others.
 
Can anybody think of any reason why the formula would work in one report but not the other?
 
Thanks!
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 12 Feb 2009 at 6:42am
That space bothers me...what if you try:
 
if TRIM({IC65A Quantity by Location.Location code})= "4" then
    {IC65A Quantity by Location.Qty on hand}
        else
            0
 
Hope this helps
IP IP Logged
Acrylon
Newbie
Newbie


Joined: 15 Jan 2009
Location: Canada
Online Status: Offline
Posts: 5
Quote Acrylon Replybullet Posted: 12 Feb 2009 at 7:16am

I figured it out - it had to do with the way I was sorting the groups in the report.

Just as a side question - what does TRIM do to a formula?
 
I know the 4 in my formula above needs to have two spaces infront of it, as it is a 3 digit field that is right aligned (it only works when I do this).
 
Thanks!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 12 Feb 2009 at 7:28am

Trim removes white space from both the left and right sides of a string.  RTRIM removes it only from the right side and LTRIM only from the left.

Sometimes, programs are not consistent in how they format/return values, so I was concerned that the number/placements of the spaces would vary and hence the unpredicatable results...getting rid of the spaces would make for a uniform interpretation of the data.

Hope this helped.

IP IP Logged
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.016 seconds.