# cursor position when jumping from field to field

84
3
01-20-2019 05:16 AM
Highlighted
Esri Regular Contributor

I have a long list of integer fields (25 fields) from where I want to calculate the total in the end. I have put all as default=0 to make sure that no "NULL" value is disabling my calculation. When I now use the "tab" to jump from field to field the cursor is placed after the default 0 so the user always has either to go manually before the zero or has to delete the zero before starting to type his own value. I would prefer to have the whole default value selected when reaching the field so it would automatically be overwritten when I start typing. Is there a way to do that? Or is there a different way to make sure I can use the field for my calculations? I was just thinking of using if(\${field}!=NULL,...) but that would mean I have to do a 25times nested "if...", right? There must be an easier way...

1 Solution

Accepted Solutions
Highlighted
Esri Regular Contributor

Hi Nicole

This suggestion originally posted here by James Tedrick‌ might be what you're after:

- if you have a few calculations, you can use the coalesce() function to provide an alternative value if a question is not answered (null) - coalesce(\${q1}, 0) will return the value in q1 when present, 0 otherwise

- an alternate formula to coalesce would be: if(string-length(\${q1}) = 0, 0, \${q1})

- If you have a large number of calculations, you can add a calculate question after each measurement to store the coalesce or if/string-length function (likely making the bind:esri:fieldType null to not add fields to the table) and use the calculate questions' values instead.

Two other (less elegant) options, using your default 0:

• User could simply enter more digits immediately after the zero - the leading zero will be ignored.
• Experiment with different appearance options. The 'spinner' appearance could be handy for questions accepting small numbers (say < 10). The 'calculator' appearance overwrites the default on entry (however, the other calculator functions it presents could cause confusion).

Hope this helps.

Kind regards,

Jim

3 Replies
Highlighted
Esri Regular Contributor

Hi Nicole

This suggestion originally posted here by James Tedrick‌ might be what you're after:

- if you have a few calculations, you can use the coalesce() function to provide an alternative value if a question is not answered (null) - coalesce(\${q1}, 0) will return the value in q1 when present, 0 otherwise

- an alternate formula to coalesce would be: if(string-length(\${q1}) = 0, 0, \${q1})

- If you have a large number of calculations, you can add a calculate question after each measurement to store the coalesce or if/string-length function (likely making the bind:esri:fieldType null to not add fields to the table) and use the calculate questions' values instead.

Two other (less elegant) options, using your default 0:

• User could simply enter more digits immediately after the zero - the leading zero will be ignored.
• Experiment with different appearance options. The 'spinner' appearance could be handy for questions accepting small numbers (say < 10). The 'calculator' appearance overwrites the default on entry (however, the other calculator functions it presents could cause confusion).

Hope this helps.

Kind regards,

Jim

Highlighted
Esri Regular Contributor

Thanks a lot! I think I will test with the calculator appearance and hear what our enumerators think about it.

Highlighted
Occasional Contributor

From my experience, you don't have to do:

if(\${field}!=NULL,...)

You can simply write:

if(\${field},...)