xforms-spec icon indicating copy to clipboard operation
xforms-spec copied to clipboard

Add if-empty() as an alias of once()

Open yanokwa opened this issue 7 years ago • 4 comments

From https://forum.opendatakit.org/t/copy-a-field-into-another/6808/

I wonder if using once() would meet your requirements. The name of this function is not very descriptive as it works like if_empty() and therefore wouldn't override a user-entered value, unless the user-entered value is empty. We should perhaps consider adding an alias for once().

yanokwa avatar Jun 10 '17 13:06 yanokwa

Nice ;). If this is considered helpful for users, I'm in favor. I think it would be helpful as I find having to explain what once() does, fairly often. It's not an intuitive function name. You could say it's even a bit misleading.

I'd just want to propose to change it into if-empty() (with hyphen) for consistency (like format-date(), weighted-checklist()).

(Let's close this if there is no interest by mid July).

MartijnR avatar Jun 16 '17 21:06 MartijnR

What about adding the alias at the XLSForm level? That way generated forms would continue to be backwards compatible for anyone running older clients. I don't think there's any example of functions being transformed in this way but it seems it could be less potentially disruptive than doing it at this level. Plus, it's what most users interact with directly anyway.

lognaturel avatar Aug 04 '17 17:08 lognaturel

We could do it like that, but in this case, if it's implemented as an alias of once() in JR/Enketo, it would be equally backwards-compatible for older generated XForms.

MartijnR avatar Aug 04 '17 17:08 MartijnR

Maybe what I'm worried about is called forwards-compatibility? I'm not sure. 😊 If I have devices running different clients and I try to push a form that uses if-empty, I could run into trouble. Doing the alias at the XLSForm level protects from that, I think.

lognaturel avatar Aug 04 '17 17:08 lognaturel