Using embedded data (date) in display logic | XM Community
Solved

Using embedded data (date) in display logic

  • 10 September 2018
  • 5 replies
  • 37 views

Userlevel 6
Badge +45
I've got a survey that collects the current date in the survey flow. I'd like to use that date in display logic for certain questions so that one of them only shows up in the month of May and another one of them does not show up in May, June, July, or August. Is this even possible? I can't find a way to parse out the month from the embedded date field.
icon

Best answer by Anonymous 10 September 2018, 17:00

View original

5 replies

Hello @VirginiaM

Follow this post to get current month in embedded data and then use it in display logic of the question.
Userlevel 6
Badge +45
Thanks @Shashi --I copied and pasted the javascript but I'm getting an alert. I think something must be missing but I don't know enough javascript to tell what it is. Any thoughts?
!
> @VirginiaM said:
> Thanks @Shashi --I copied and pasted the javascript but I'm getting an alert. I think something must be missing but I don't know enough javascript to tell what it is. Any thoughts?
> !
>

Thanks for posting the issue. I have updated the code in that post

The error is on "var n=...." line, the correct code is `var n=monthNames[d.getMonth()]; `
Userlevel 6
Badge +45
That took care of the alert @Shashi! Is this written in such a way that it will automatically populate with the current date (month)? I have current date as an embedded data field as well.
> @VirginiaM said:
> That took care of the alert @Shashi! Is this written in such a way that it will automatically populate with the current date (month)? I have current date as an embedded data field as well.

Yes, no need of current date. the above code will give the current date (month)

Leave a Reply