Hi folks!
I have this formula:
CONCAT($A," “,$B,” ",$C)
When I don’t have a value for $B, the result is an extra space between $A and $C
There is any way to remove it?
Thanks in advance!
Eduardo
Hi folks!
I have this formula:
CONCAT($A," “,$B,” ",$C)
When I don’t have a value for $B, the result is an extra space between $A and $C
There is any way to remove it?
Thanks in advance!
Eduardo
You could use a conditional:
if $B != '':
CONCAT($A," ",$B," ",$C)
else:
CONCAT($A," ",$C)
Beautiful! Thanks!
But I need a “return” somewhere?
Oh, right. I tested it, realized I needed to put in returns, put in the returns when I was testing, and then forgot to update the code here
if $B != '':
return CONCAT($A," ",$B," ",$C)
else:
return CONCAT($A," ",$C)
Thanks! I got this:
if $infraspecificEpithet != '':
nome= CONCAT($genus," ",$specificEpithet," ",$taxonRank," ",$infraspecificEpithet," ",$scientificNameAuthorship)
else:
nome= CONCAT($genus," ",$specificEpithet," ",$scientificNameAuthorship)
return nome
Another way
list = []
a = IF($A!='',list.append($A),None)
b = IF($B!='',list.append($B),None)
c = IF($C!='',list.append($C),None)
return ' '.join(list)
If you need change separator is only one point
return ', '.join(list)