Using embedded data (date) in display logic | XM Community
Skip to main content
Solved

Using embedded data (date) in display logic

  • September 10, 2018
  • 5 replies
  • 163 views

VirginiaM
Level 4 ●●●●
Forum|alt.badge.img+54
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.

Best answer by Anonymous

Hello @VirginiaM Follow this post to get current month in embedded data and then use it in display logic of the question.

5 replies

  • Answer
  • September 10, 2018
Hello @VirginiaM Follow this post to get current month in embedded data and then use it in display logic of the question.

VirginiaM
Level 4 ●●●●
Forum|alt.badge.img+54
  • Author
  • Level 4 ●●●●
  • September 11, 2018
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? !

  • September 11, 2018
> @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()]; `

VirginiaM
Level 4 ●●●●
Forum|alt.badge.img+54
  • Author
  • Level 4 ●●●●
  • September 11, 2018
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.

  • September 11, 2018
> @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)