HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

How to create a Salutation from a Custom Field?


Hi there,
my LL works proper!
In my Livelookup i receive the GENDER … it M (MALE) or F(FEMALE)
Now i like to generate the Salutation “geehrter Herr” if GENDER= MALE and “geehrte Frau” if GENDER=FEMALE

This due to that we like to reply to our Customers personalized!
So our replies lookk like:
Sehr ##custom6## ##last_name##,

bla bla

But i receive only M or F from my LL!
So i must translate the received GENDER like:
If GENDER = M then custom6="geehrter Herr"
if GENDER=F then custom6=“geehrte Frau”

BUT HOW and WHERE to do?

thanks for Answer


So in the data source you query you mean you get back M/F right? OK so in the XML probably at the bottom of the LL script you’d put the logic. It depends on your exact script but you’d add in something like:

‘’.($data[‘gender’] == ‘M’ ? “geehrter Herr” : “geehrte Frau”).’’


thx great! i’ve tried … but have to ask my developer :wink: no result…
my script:

<?php while($row = mysql_fetch_assoc($result)): ?>

<customer_id><?php echo $row['ID'] ?></customer_id>
<first_name><?php echo $row['Vorname'] ?></first_name>
<last_name><?php echo $row['Name'] ?></last_name>
<?php echo $row['Gender'] ?>
<?php echo $row['Geburtsdatum'] ?>
<?php echo $row['EMail'] ?>
<?php echo $row['Strasse'] ?>
<?php echo $row['PLZ'] ?>
<?php echo $row['Ort'] ?>
<?php echo $row['KTO'] ?>
<?php echo $row['BLZ'] ?>

<![CDATA[ <?php echo ''.$row['ID'].'' ?> ]]>


’. $data[‘Gender’] == ‘M’ ? “geehrter Herr” : “geehrte Frau”.’
<?php endwhile; ?>

Insert of Customer_ID works well …but the result of ##custom27 =’. $data[‘Gender’] == ‘M’ ? “geehrter Herr” : “geehrte Frau”.’



OK just 2 changes I think should fix it.

#1 - Move the tag inside the closing tag, right now it’s past it.

#2 - the line should be:
<?php echo ($data['Gender'] == 'M' ? "geehrter Herr" : "geehrte Frau") ?>


$DATA is wrong!

This is correct:
<?php if ($row['Gender'] == 'M') echo "geehrter Herr"; elseif ($row['Gender'] == 'F') echo "geehrte Frau"; else echo "ERROR"; ?>

need row instead of data
Now it works well,
thanks for your help.



oh yep, nice catch! Excellent.