FHIR Chat · Auto-incrementing indexes · shorthand

Stream: shorthand

Topic: Auto-incrementing indexes


view this post on Zulip Elliot Silver (Aug 07 2020 at 16:15):

It would be great if there was a way to specify the indexes for repeating elements without having to put in fixed integers in each one. For example, in a long questionnaire instance, I have hundreds of lines that look like:

* item[6].item[2].answerOption[0].valueCoding = http://terminology.hl7.org/CodeSystem/v2-0136#N // "No (i.e., case remains asymptomatic)"

If I decide to add a new item earlier in the form, or reorder content, I need to go through and manually update all of those indexes. Would it be possible to add counters to the language so that there is no need to manage the indexes? As a starting point, something like:

  • %a -- reset counter a to 0, and give its value
  • +a -- increment counter a, and give its value
  • =a -- give value of a.
    This would let me do:
* item[%a].linkId = ...
* item[=a].text = "group 1"
* item[=a].type = \#group
* item[=a].item[%b].linkId = ...
* item[=a].item[=b].text = ...
* item[=a].item[+b].linkId = ...
* item[=a].item[=b].text = ...
* item[+a].linkId = ...
* item[=a].text = "group 2"
* item[=a].type = \#group
* item[=a].item[%b].linkId = ...
* item[=a].item[=b].text = ...
* item[=a].item[+b].linkId = ...
* item[=a].item[=b].text = ...
* item[+a].text = ...```

(even better would be a way to do sub-counters, so that b would be reset each time a incremented.)

view this post on Zulip Jean Duteau (Aug 07 2020 at 16:15):

you're coming late to the party. :). there is already a proposal for this.

view this post on Zulip Elliot Silver (Aug 07 2020 at 16:16):

I am. Good, glad I'm not the only one.

view this post on Zulip David Pyke (Aug 07 2020 at 16:16):

Yep, I started it when I deleted an index in the middle and everything went foo

view this post on Zulip Jean Duteau (Aug 07 2020 at 16:18):

If you search for "Feedback Needed: Array Syntax", you'll see Chris' proposal which isn't that much different from yours.

view this post on Zulip Elliot Silver (Aug 07 2020 at 16:28):

OK, looks like you all have it under control.


Last updated: Apr 12 2022 at 19:14 UTC