• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Create!Form Concat if then else help

pulsatk

Member
I am trying to tackle a merge issue using variables and conditional statements.

Requirement

Concatenate desc1 and desc 2 variable with a - joining the 2 fields.
In some instances desc 2 does not exist. This is where the merge issue arises.

I have a variable called Desc1Concat which concatenates desc 1 along with -
I have another variable called Desc2Concat which concatenates desc1concat variable with desc2 variable. This works as is as long as desc2 exists.
If desc2 does not exist it will not merge. I don't see how I can indicate an else statement within the conditional for concat?

Thanks
Teri
 

KSwaeby

Reputable Poster
Make two UserVar statements for the usrvar name. The 1st one has condition TRUE and just has desc1 assigned to it. The 2nd one has condition trim(desc2) != "" and uses either concat or + statement to put all of the data together something like this;

concat(concat(desc1," - "),desc2) -- or something like that, I may not have typed that exactly right

OR

trim(desc1) + " - " + trim(desc2)


When there are multiple uservar statements for the same var name the logic works down the list. The 1st one is evaluated which is condition TRUE and assigns the data to the var. Then evaluates the 2nd condition, if true the data in var is replaced with the 2nd one.

Hope this helps


Karen.
 
Top