I am trying to write a display condition and would like to include an empty
string in the condition. Are single quotes okay? For example if I wrote
display logic as *display question if /data/visit_date = ''. *Would this
work?
···
On Wed, Aug 31, 2016 at 8:05 PM, James Tinkamanyire < jamestinkamanyire@gmail.com> wrote:
Hello,
I am trying to write a display condition and would like to include an
empty string in the condition. Are single quotes okay? For example if I
wrote display logic as *display question if /data/visit_date = ''. *Would
this work?
I am trying to write a display condition and would like to include an
empty string in the condition. Are single quotes okay? For example if I
wrote display logic as *display question if /data/visit_date = ''. *Would
this work?
Unfortunately date questions are a bit tricky because if a date question is
displayed to the user then the default value will be today's date, unless a
default value has been set, so it will never be blank. For this reason, if
you want to create a display condition around a date question, it can
sometimes be better to but a yes/no question before a date question (such
as "do you want to enter a visit date?") and use that as the basis for your
logic.
Jeremy
···
On Wed, Aug 31, 2016 at 8:13 PM, James Tinkamanyire < jamestinkamanyire@gmail.com> wrote:
Thanks, William. Can I use this for a date field as well?
On Thu, Sep 1, 2016 at 3:11 AM, William Pride wpride@dimagi.com wrote:
I am trying to write a display condition and would like to include an
empty string in the condition. Are single quotes okay? For example if I
wrote display logic as *display question if /data/visit_date = ''. *Would
this work?
Unfortunately date questions are a bit tricky because if a date question is
displayed to the user then the default value will be today's date, unless a
default value has been set, so it will never be blank. For this reason, if
you want to create a display condition around a date question, it can
sometimes be better to but a yes/no question before a date question (such
as "do you want to enter a visit date?") and use that as the basis for your
logic.
Jeremy
···
Sent from a mobile device
On Sep 10, 2016 5:58 PM, "Jeremy W." wrote:
I am trying to write a display condition and would like to include an
empty string in the condition. Are single quotes okay? For example if I
wrote display logic as *display question if /data/visit_date = ''. *Would
this work?
It is still not clear for me (as I can't find it in the page you mention), if for decimals and hidden values I can include an empty string in the condition using single quotes.
e.g. #form/variables/weightAdult=''
You can definitely represent the "empty" condition with single quotes.
Whether a decimal question is 'equal' to empty string can depend on a few different elements, though.
An unanswered decimal question will be equal to ''. A decimal question that is equal to 0 (or 0.0) won't be equal to 0.0, so if the question is required it will only be equal to 'blank' when it is unanswered.