cannot use function, keyword of the language | Community
Skip to main content
Level 6
December 7, 2023
Solved

cannot use function, keyword of the language

  • December 7, 2023
  • 1 reply
  • 1004 views

Hi there,

 

I am running into this issue where in the action, request parameters, I get this error message:

 

The expression is invalid : You cannot use the word 'toString' like this because it is a keyword of the language. Please, add quotes to fix your expression.

 

I am trying to send a concatenated string into the request parameter. Sometimes I will need to do data type conversion, and in this case, converting the datetime to string.

 

This works: toString(now())

This does not work: #{ExperiencePlatform.ProfileFieldGroup.profile._tenant.accountid} + toString(now())

This does not work: 'Test' + toString(now())

 

How do I get around this?

 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mohan_Dugganab

@akwankl you can use an extra parentheses enclosing the toString() function to make it work.

Example:- 'Test' + (toString(now()))

1 reply

SatheeskannaK
Community Advisor
Community Advisor
December 7, 2023

@akwankl, You can use the concat function. Try something like this,

concat(concat(#{ExperiencePlatform.ProfileFieldGroup.profile._tenant.accountid},"+"),toString(now()))

Thanks, Sathees
akwanklAuthor
Level 6
December 7, 2023

thanks @satheeskannak, that worked! Can you explain why we can't use what I had originally? This solution is not very intuitive. 

Mohan_Dugganab
Adobe Employee
Mohan_DugganabAdobe EmployeeAccepted solution
Adobe Employee
December 8, 2023

@akwankl you can use an extra parentheses enclosing the toString() function to make it work.

Example:- 'Test' + (toString(now()))