Expand my Community achievements bar.

SOLVED

Date function not working properly in JSON

Avatar

Level 2

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}}

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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.

View solution in original post

3 Replies

Avatar

Community Advisor

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

Avatar

Administrator

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

Avatar

Correct answer by
Employee Advisor

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.