Date function not working properly in JSON | Community
Skip to main content
December 29, 2022
Solved

Date function not working properly in JSON

  • December 29, 2022
  • 3 replies
  • 933 views

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.
Best answer by akshaaga

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
Community Advisor
Community Advisor
January 3, 2023

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!

Thanks, Sathees
Sukrity_Wadhwa
Community Manager
Community Manager
January 24, 2023

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!

Sukrity Wadhwa
akshaaga
Adobe Employee
akshaagaAdobe EmployeeAccepted solution
Adobe Employee
February 12, 2023

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.