I have been struggling to figure this out by myself all day but must now defer to the forum. Annoyingly I know that it is going to be very simple for someone out there.
I am trying to make a printable label on a form in Servoy.
If I use merge fields:
%%title%% %%first_name%% %%last_name%%<br>
%%address_1%%<br>
%%address_2%%<br>
%%address_3%%<br>
%%city%%<br>
%%county%%<br>
%%postcode%%<br>
%%country%%
it works, but I get blank lines wherever there is an empty field.
If I try to make the label as the result of a calculation, I am unable to figure out the syntax, the closest I have got (I think) is:
return
if (title != null && title != "" )
{
return title
}
else
{
return ""
}
if (first_name != null && first_name != "")
{
return first_name + " "
}
else
{
return ""
}
if (last_name != null && last_name != "")
{
return last_name + " ";
}
The problem with this is that it only returns the first evaluation. I cannot find a way to join them together (+ & . etc. don't work)
I am guessing that I have to nest the if statements but this doesn't seem to work either (because I keep getting syntax errors). I have read the manual cover to cover and tried to find syntax examples for doing this and simply cannot.
I would be very grateful if anyone can point me at the right literature, and or give me a hint about which way to actually do this.
Many thanks for your time.
Bevil