If statement and split function

211 views Asked by At

My memo line that looks something like this:

Return: #999 100.00\NSF|Balance=$242.00. Available Balance=$50.00`

or

Return: #888 45.90\WD REST.

I need it to return everything before the | if there is one, or the whole memo line if there isn't a |. Right now I have two formulas that give everything before the | or nothing if there isn't a |

memo1: left({table.memo},instr(table.memo},"|"))

memo2: replace({@Memo1},"|"," ")

How can I configure this such that if a | is present, return @Memo2, else return {table.memo}?

2

There are 2 answers

2
4444 On BEST ANSWER

If I understand correctly, just make one more formula like this:

IF instr({table.memo},"|")>0
THEN {@Memo2}
ELSE {table.memo}

This displays one formula or the other based on the presence of that vertical line character.

0
Hiten004 On

I would use an if statement with instr:

memo1: left({table.memo},instr(table.memo},"|"))
memo2: replace({@Memo1},"|"," ")

if instr(table.memo} > 0 
   left({table.memo},instr(table.memo},"|"))
else 
   replace({@Memo1},"|"," ")

Please try something like that. (I did not check the syntax, so please check my work.)

Example for if