Select to view content in your preferred language

Wrtie Expression to Caluclate Answer Based on Date Submitted Range

307
2
03-27-2026 09:38 AM
KylaDolan
Emerging Contributor

 Im setting up a survey for insect trapping and I want my question "set_number" to calculate my answer based on a particular date range submitted by the person who is filling out the survey.

I'm using the expression below, and it is not populating in the question.

if((format-date(${_date},'yyyyMMdd') >= '20260413') and (format-date(${_date},'yyyyMMdd') <= '20260417'), 'Set 1', '')

I also have the scripts function blank...not sure if that makes a difference. I am updating everything directly in my xlxsForm. 

Screenshot 2026-03-27 093325.jpgScreenshot 2026-03-27 093423.jpg

 

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

I do not think you can start a field name with an underscore.  

0 Kudos
KylaDolan
Emerging Contributor

I solved it...used this expression instead

if((format-date(${_date}, '%Y%m%d') >= '20260413') and (format-date(${_date}, '%Y%m%d') <= '20260420'), 'Set 1',")

0 Kudos