AJO formatDate contextual attribute | Community
Skip to main content
campaignap
Level 3
October 8, 2023
Solved

AJO formatDate contextual attribute

  • October 8, 2023
  • 1 reply
  • 3302 views

I wish to format a contextual attribute coming from an event in a journey.

I have tried a few variations below for the snippet but none have worked so far.

 

{%= formatDate(context.journey.events.``1527359670``._tester.modifyDate, "DD MMMM YYYY K:mm a") %}
Invalid syntax Error in parsing PQL expression "formatDate(context.journey.events.``1527359670``._tester.modifyDate, "DD MMMM YYYY K:mm a", "en-NZ")": line 1:34 token recognition error at: '``'. Error beginning at position: Line 1, Character 1

{%= formatDate(context.journey.events.`1527359670`._tester.modifyDate, "DD MMMM YYYY K:mm a") %}
Invalid syntax Usage of function "formatDate" does not match available signatures. Usage: [PQLSchemaImplJson({"meta:xdmType":"string"}), PQLSchemaImplJson({"meta:xdmType":"string"})] Signatures: [(List(PQLSchemaImplJson({"meta:xdmType":"date-time"}), PQLSchemaImplJson({"meta:xdmType":"string"}), PQLSchemaImplJson({"meta:xdmType":"string"})),PQLSchemaImplJson({"meta:xdmType":"string"})), (List(PQLSchemaImplJson({"meta:xdmType":"date-time"}), PQLSchemaImplJson({"meta:xdmType":"string"})),PQLSchemaImplJson({"meta:xdmType":"string"}))]. Error beginning at position: Line 1, Character 1

{%= formatDate(context.journey.events.1527359670._tester.modifyDate, "DD MMMM YYYY K:mm a") %}
Invalid syntax Error in parsing PQL expression "formatDate(context.journey.events.1527359670._tester.modifyDate, "DD MMMM YYYY K:mm a")": line 1:10 mismatched input '(' expecting <EOF>. Error beginning at position: Line 1, Character 1

 

Any advise or suggestions are appreciated.

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 IvanMi1

Your first two examples - the issue is with the quotes around the contextual attributes. 

 

Depending on the format of attribute you are bringing in you might want to try stringToDate as your function. or first convert your value -> toString and then use stringToDate. 

 

Using the let function to rename the attribute may make it easier to work with in later functions. 

 

 

1 reply

IvanMi1Adobe EmployeeAccepted solution
Adobe Employee
October 9, 2023

Your first two examples - the issue is with the quotes around the contextual attributes. 

 

Depending on the format of attribute you are bringing in you might want to try stringToDate as your function. or first convert your value -> toString and then use stringToDate. 

 

Using the let function to rename the attribute may make it easier to work with in later functions. 

 

 

Level 4
June 18, 2024

Hi @campaignap @ivanmi1 
this solution worked ? IF yes can you share the outcome and some sample values