Author |
Message |
Kitty1
Senior Member
Joined: 14 Apr 2010
Online Status: Offline
Posts: 159
|
Topic: Conditional Text Posted: 06 May 2014 at 11:12am |
Hi, I have a report which is grouped by Transaction Type, which is a 2 digit field in the G/L file. for example 05 stands for adjustment, 10 stands for invoice, etc. Is there a way that I can have text print out for each group level, explaining what the code means? I have no table to pull the descriptions from. Thanks in advance for your help!
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 06 May 2014 at 11:20am |
You would have to write a formula to do this and, if any transaction types are added, you will have to update your report. Your formula might look something like this:[code]
Switch(
{MyTable.TransactionType}='05', 'Adjustment',
{MyTable.TransactionType}='10', 'Invoice',
...<and so on for all of your transaction types>...
True, 'Unknown Transaction Type - ' + {MyTable.TransactionType}
)
The last line will provide a default description if there is a transaction type that you haven't accounted for.
-Dell
|
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 06 May 2014 at 11:21am |
SWITCH should work, but I never remember the syntax off the top of my head...something like
SWITCH({table.field},
"02", "what a 2 means",
"10", "what a 10 means")
or there is the if then way
if {table.field}="05" then "adjustment"
else if {table.field}="10" then "invoice"
//etc
HTH
|
IP Logged |
|
Kitty1
Senior Member
Joined: 14 Apr 2010
Online Status: Offline
Posts: 159
|
Posted: 07 May 2014 at 10:37am |
Thank you. I am unfamiliar with Switch. Have never used it before. Is there an easy way to explain it ?
|
IP Logged |
|
hilfy
Admin Group
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
|
Posted: 08 May 2014 at 3:39am |
Switch is similar to a "Case" statement in programming. Basically, it's like a big if..then..else if..then else if.. type statemtent. If you'll look at what Lockwelle and I both posted, we set it up so that it looks like "pairs" of statements separated by commas. The first part of each pair evaluates to true or false (the "if" part of the statement) and the second is the value you want to return if the first part is true (the "then" part of the statement. The final "True" in what I posted is like a "default" value that defines the result if none of the other statements are true.
-Dell
|
|
IP Logged |
|
|