Skip to main content
Level 2
Dec 29, 2022 12:39 PM UTC
Solved

Date function not working properly in JSON

When we tried below code it is not working properly in AJO JSON. Anyone know how do we check date > 1 or date < 14

{{#each profile._nordea.Trigger.Triggers as |ABC|}}
{%#if ABC.triggerName="trg_UAT_NCCL" and (ABC.dateAttribute02.getDayOfYear() <= currentDayOfYear())%} {"content_id":"UAT"}
{%/if%}
{{/each}}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
akshaaga
akshaagaAccepted solution
Adobe Employee
Feb 12, 2023 5:06 AM UTC

Hi @dboro ,

 

Can you check the following way -

{{#each profile._nordea.Trigger.Triggers as |ABC|}}
{% if ABC.triggerName == "trg_UAT_NCCL" and (ABC.dateAttribute02.getDayOfYear() <= currentDayOfYear() and (ABC.dateAttribute02.getDate() > 1 or ABC.dateAttribute02.getDate() < 14)) %}
{"content_id":"UAT"}
{% endif %}
{{/each}}


In this code, the if statement checks whether the triggerName is equal to "trg_UAT_NCCL" and the day of the year represented by dateAttribute02 is less than or equal to the current day of the year and also the date is either greater than 1 or less than 14.

If these conditions are met, then the JSON object {"content_id":"UAT"} will be output.

3 replies

SatheeskannaK
Adobe Champion, Community Advisor, UG Leader
Adobe Champion, Community Advisor, UG Leader
Jan 3, 2023 9:55 PM UTC

Hi @dboro,

 

Something like this I tried and it's working,

{%#if profile._repo.createDate.getDayOfYear() > 1 or now.getDayOfYear() < 14 %}
{{profile._repo.createDate}}
{%else%}
This is test

{%/if%}

 

Thanks!

Translate
Thanks, Sathees
Sukrity_Wadhwa
Level 4
Jan 24, 2023 8:05 AM UTC

Hi @dboro,

Was the given solution helpful for you in resolving your query or do you still need more help here? Do let us know.

Thanks!

Translate
Sukrity Wadhwa
akshaaga
Adobe Employee
akshaagaAdobe EmployeeAccepted solution
Adobe Employee
Feb 12, 2023 5:06 AM UTC

Hi @dboro ,

 

Can you check the following way -

{{#each profile._nordea.Trigger.Triggers as |ABC|}}
{% if ABC.triggerName == "trg_UAT_NCCL" and (ABC.dateAttribute02.getDayOfYear() <= currentDayOfYear() and (ABC.dateAttribute02.getDate() > 1 or ABC.dateAttribute02.getDate() < 14)) %}
{"content_id":"UAT"}
{% endif %}
{{/each}}


In this code, the if statement checks whether the triggerName is equal to "trg_UAT_NCCL" and the day of the year represented by dateAttribute02 is less than or equal to the current day of the year and also the date is either greater than 1 or less than 14.

If these conditions are met, then the JSON object {"content_id":"UAT"} will be output.

Translate