Hi there, may i ask what is the equivalent of titleCase (that is found in email) I can use in expression in Custom Action Field? A typical use case/my objective is to transform JOHN SMITH EXAMPLE to John Smith Example - basically start each word with a block letter.
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
It's strange to see that there are multiple words in first name.
Below is a simple example and you can expand on it using additional functions like listSize (if needed)
if ( indexOf("MOHAN DUGGANABOIENA"," ")>=0 )
then
(
(upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 1))) + ' '+ (upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 1)))
)
else
(
(upper(substr('MOHAN', 0, 1))) + (lower( substr('MOHAN', 1)))
)
Views
Replies
Total Likes
@AK5 try lower(String) function.
Views
Replies
Total Likes
Hi @anuhya, that's just lower case. I need to basically start each word with a block letter. Reminder, what's the expression equivalent to the titleCase that we use in Email HTML?
Thanks.
Views
Replies
Total Likes
@AK5 try camelCase function.
Views
Replies
Total Likes
Thanks for trying - much appreciated, don't have camel in my case:
Views
Replies
Total Likes
Hi @AK5 ,
Try this concat(upper(substr('DAVID', 0, 1)),lower(substr('DAVID',1)))
Replace DAVID by firstname or lastname.
Thanks,
David
Views
Replies
Total Likes
Thanks @DavidKangni, it only formatted the first letter of the firstname: John smith example. The expected outcome is John Smith Example.
Views
Replies
Total Likes
you can replicate the same logic for lastname
concat(upper(substr('JOHN', 0, 1)),lower(substr('JOHN',1))) +' '+concat(upper(substr('SMITH', 0, 1)),lower(substr('SMITH',1)))
Views
Replies
Total Likes
(upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 1)))
You can validate using an expression on the above lines
Views
Replies
Total Likes
Thanks @Mohan_Dugganab, the result is the same as the above solution: it only formatted the first letter of the firstname: John smith example. The expected outcome is John Smith Example. Thanks.
Views
Replies
Total Likes
Kindly try this
(upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 1))) + ' '+ (upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 1)))
Views
Replies
Total Likes
Thanks @Mohan_Dugganab, I'm only getting the first word in uppercase and subsequent ones in lowercase: John smith example.
Any other ideas? Thanks!
Views
Replies
Total Likes
Hopefully, you have validated with the latest expression as I see the right result being returned.
Views
Replies
Total Likes
Hi @Mohan_Dugganab, yes, the result i received was John smith example. Thanks.
Views
Replies
Total Likes
I ran a test and shows up correctly
Expression -
(upper(substr('MOHAN', 0, 1))) + (lower( substr('MOHAN', 1))) + ' '+ (upper(substr('DUGGANABOIENA', 0, 1))) + (lower( substr('DUGGANABOIENA', 1)))
Result -
Views
Replies
Total Likes
Hi @Mohan_Dugganab, just to clarify, JOHN SMITH EXAMPLE is all in the firstname field. And it can be more than 3 words.
Thanks
Views
Replies
Total Likes
It's strange to see that there are multiple words in first name.
Below is a simple example and you can expand on it using additional functions like listSize (if needed)
if ( indexOf("MOHAN DUGGANABOIENA"," ")>=0 )
then
(
(upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 1))) + ' '+ (upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 1)))
)
else
(
(upper(substr('MOHAN', 0, 1))) + (lower( substr('MOHAN', 1)))
)
Views
Replies
Total Likes
Brilliant! Thanks heaps @Mohan_Dugganab
Views
Replies
Total Likes
Views
Likes
Replies