Closed mgguinne closed 8 years ago
Your first example splits the name into First Name and Last Name, which is what you're asking, but my guess is that you want to use the parts separately? If so, what exactly is your goal?
FWIW, you can use the separate parts like this:
First name: ${message.from.name.split()[0]}
Last name: ${message.from.name.split()[1]}
And with some advanced templating, you don't need to call .split()
twice:
{{ setvar("name", "message.From.name.split()") }}
First name: ${name[0]}
Last name: ${name[1]}
Thanks Robert,
That was 100% what I was after :) Is this just standard python code or something else?
Can I suggest adding this to main help file?
Cheers Mike
It's a mix between the template engine that QF uses (pyratemp) and Python :)
I cant seem to find a way to split the "message.from.name" into First Name Last Name etc.
I have tried:
Example Name: John Smith ${message.from.name.split()} But I get: [u'John', u'Smith']
${message.from.name.split(' ' ,1)}
I have tried a few ways to get around this but with no luck, any thoughts etc?