I have built a feature report based on Survey123 data and need to change a date to text based on the year of the date. If the date has a year of 9999, I want to replace the full date with text. Is this something that is possible?
Solved! Go to Solution.
Hi @StevenHughes44,
You could do this by using a conditional report element and the format method to return the year.
For example:
${if (date1 |format:”YYYY”)==”9999”}
A year of 9999 was entered.
${/}
Thanks,
-Barbara
Hi @StevenHughes44,
You could do this by using a conditional report element and the format method to return the year.
For example:
${if (date1 |format:”YYYY”)==”9999”}
A year of 9999 was entered.
${/}
Thanks,
-Barbara
Thank you for your help on this. When I use the element as written, I get an error stating the the end tag is unopened. If I load the template without the end tag, the report does generate with the element result of this:
@StevenHughes44 Can you provide the report template and XLSForm you're using?
@StevenHughes44 Thanks for sending the template. It looks like you're missing a space after the "if".
Adding the space has fixed the issue. What would I need to update in the element so this is shows a date that is not equal to "9999"?
Glad that worked! The operator for not equals is '!='. There is also a table in the Survey123 Report template documentation that includes all the operators you can use for a conditional section.