| Author |
Message |
Rivian
Newbie
Joined: 23 Oct 2013
Online Status: Offline
Posts: 6
|

Topic: Search Expression Help Posted: 25 Oct 2013 at 6:17am |
|
Hello Everyone,
I'm working on a crystal report that returns data on a vendor, their address, terms and currency paid in.
When I get to the terms, the table lists them as a particular single digit value (ie ! or @ or # or % ..etc)
What I'm trying to do is create a conversion on search.
So, if the term comes back on search of the vendor as ! then the text shown is Upon RCPT.
Can someone help me create a formula for that?
Thanks very much!
Andrea
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 25 Oct 2013 at 7:04am |
|
if {table.field} = "!" then "Upon RCPT";
if {table.field} = "@" then...
|
IP Logged |
|
Rivian
Newbie
Joined: 23 Oct 2013
Online Status: Offline
Posts: 6
|

Posted: 25 Oct 2013 at 8:36am |
|
Ok, I don't get any errors but it's still not pulling the data. All I get are blank spaces.
Any thoughts?
Here's the code:
If {V_VENDOR_PAY_TO.PAYMENT_TERMS}= "!" then "Upon RCPT";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "#" then "RCPT FAX";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "$" then "RCPT INV";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "%" then "WT BF SHIP";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "&" then "Net 90";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "0" then "Net 30";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "1" then "1,10 Net 30";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "2" then "1,30 EM";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "3" then "1,30 Net 60";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "4" then "1,10 Net 40";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "5" then "1/2 30, 60";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "6" then "10 MF";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "7" then "120 BOL";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "8" then "15 MF";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "9" then "15 MTH";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "@" then "RCPT BOL";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "A" then "1ST OF MTH";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "B" then "2% RCPT BOL";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "C" then "2,15 Net 30";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "D" then "2,20 Net 30";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "E" then "2,30 Net 60";
if {V_VENDOR_PAY_TO.PAYMENT_TERMS} = "F" then "2,10 Net 30"
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 25 Oct 2013 at 8:51am |
|
for debugging purposes you could change it to something like:
local stringvar x := {V_VENDOR_PAY_TO.PAYMENT_TERMS};
If {V_VENDOR_PAY_TO.PAYMENT_TERMS}= "!" then x:="Upon RCPT";
....
x
this will display the value that you missed...
or you could also display the field {V_VENDOR_PAY_TO.PAYMENT_TERMS} on the report and see which one is missing...if none are then...probably the first change...
or the structure of the formula should be like:
if then
else
if then
else
if then
it's a thought
|
IP Logged |
|
Rivian
Newbie
Joined: 23 Oct 2013
Online Status: Offline
Posts: 6
|

Posted: 25 Oct 2013 at 9:16am |
|
It looks like the first line of code always works but when I go to add the second to thirtieth lines, it doesn't recognize those and returns a blank for all lines. There has to be something I'm missing that will help it read those additional lines.
|
IP Logged |
|
kevlray
Admin Group
Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
|

Posted: 25 Oct 2013 at 9:25am |
|
Is
{V_VENDOR_PAY_TO.PAYMENT_TERMS} exactly one character long (no leading or trailing spaces)? The code looks correct, but how does the data look?
|
IP Logged |
|
Rivian
Newbie
Joined: 23 Oct 2013
Online Status: Offline
Posts: 6
|

Posted: 25 Oct 2013 at 9:39am |
|
Ok, this is what ended up working:
StringVar Result;
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "!" then
Result := "UPON RCPT"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "#" then
Result := Result + "RCPT FAX"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "$" then
Result := Result + "RCPT INV"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "%" then
Result := Result + "WT BF SHIP"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "&" then
Result := Result + "Net 90"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "0" then
Result := Result + "Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "1" then
Result := Result + "1,10 Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "2" then
Result := Result + "1,30 EM"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "3" then
Result := Result + "1,30 Net 60"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "4" then
Result := Result + "1,10 Net 40"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "5" then
Result := Result + "1/2 30, 60"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "6" then
Result := Result + "10 MF"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "7" then
Result := Result + "120 BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "8" then
Result := Result + "15 MF"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "9" then
Result := Result + "15 MTH"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "@" then
Result := Result + "RCPT BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "A" then
Result := Result + "1ST OF MTH"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "B" then
Result := Result + "2% RCPT BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "C" then
Result := Result + "2,15 Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "D" then
Result := Result + "2,20 Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "E" then
Result := Result + "2,30 Net 60"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "F" then
Result := Result + "2,10 Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "G" then
Result := Result + "25MF"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "H" then
Result := Result + "3,10 Net 30"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "I" then
Result := Result + "30 DAYS BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "J" then
Result := Result + "30PO, 70 BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "K" then
Result := Result + "45 DAYS BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "L" then
Result := Result + "50% INV"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "M" then
Result := Result + "60 DAYS BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "N" then
Result := Result + "90 DAYS BOL"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "O" then
Result := Result + "90 BOL-LOC"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "P" then
Result := Result + "90 1ST MF"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "Q" then
Result := Result + "AD NET 15"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "R" then
Result := Result + "NET 10"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "S" then
Result := Result + "NET 15"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "U" then
Result := Result + "UPON RECEIPT"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "V" then
Result := Result + "NET 40"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "W" then
Result := Result + "NET 40-WT"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "X" then
Result := Result + "NET 45"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "Y" then
Result := Result + "NET 60"
else
if ({V_VENDOR_PAY_TO.PAYMENT_TERMS}) = "Z" then
Result := Result + "RCPT OF DOC";
|
IP Logged |
|
|
|