"Dynamic Data Attachments" calculation syntax enhancement

Hello devs,

Dynamic Data Attachments is a promising feature with vast capabilities. It requires some enhancements from the UX level, but overall , it’s awesome.

One point that stopped me is the XLSForm syntax which’s unique inside this module. I don’t know how the decision was took. It’s not aligned with the patterns used in XLSForm.

We’re used to the following syntax for the calculated fields , checkout the query nodes

count(instance('survey')/root/item[P_Enumerator])	

While just inside Dynamic Data Attachments the rule is changed to use the below

count(instance('survey')/root/data[P_Enumerator])	

Why don’t we replace the data node by item node,so that we preserver consistency along the project. Alongside that there’s some features that are not working well due to this new pattern that’s introduced. If we rename the node, everything goes well.

I’m open for discussion :slight_smile:

1 Like

Hi @haidarz,

Thank you to bring this to our attention. Let me review this with the dev team and I’ll get back to you.

Meanwhile, if you feel comfortable with Python programming, you can still submit a PR to change the behaviour :wink:

FYI: data has been chosen to be consistent with our API endpoint (i.e.: /api/v2/assets/<asset_uid>/data.json)

1 Like

Hello @nolive ,

I understand that you where trying to find a key to be consistent in a way or another. I believe that item is a better choice since all xpath evaluations are using the xpath root/item.

I’ve skimmed the pyxform library and I’m confident enough that replacing data by item will have in return enough value and better integration.

Will try to raise PR to github asap.

Thanks :smiley:

2 Likes

I think that you may be interested in this line

1 Like

Exactly, that’s what I’m updating right now and adding my defense in the code comment.

2 Likes

I’ve raised the PR.

Kindly check

Next step, we need to update the docs if the PR is merged.

1 Like