Additional to thijs answer: as an empty string and a string which is empty are 2 different things - empty vs '' - use this expression
(if trim($Firstname) != '’ then $Firstname else empty) +
(if trim($Lastname) != '’ then $Lastname else empty)
Edit: replaced comparison on empty with comparison on '’ ( thanks Ward)
Hoi Pragya,
You could try an IF THEN ELSE statement:
(If $Firstname != empty THEN $Firstname ELSE ‘’) +
(IF $Lastname != empty THEN $Lastname ELSE ‘’)