Expand my Community achievements bar.

Adobe Journey Optimizer Community Lens 6th edition is out.
SOLVED

AJO formatDate contextual attribute

Avatar

Level 3

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.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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. 

 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

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.