Dear All,
The problem I am experiencing is related to my previous post Calculate date with number. I creating this as a new post since it is a different issue related to the form I am working on.
The form I am working on is fp_unmet_need_e-tracking_tool.xlsx (29.3 KB)
The example, which is shared by @mathieubossaert test_tool2.xlsx (13.1 KB), working perfectly.
However, I am unable to convert my form fp_unmet_need_e-tracking_tool.xlsx (29.3 KB) to XML and I noticed that the calculation field is conflicting with Rows 33-35 of the form.
I am getting error during the conversion of the form:
Error: The same instance id will be generated for different external instance source URIs. Please check the form. Instance name: 'services', Existing type: 'pulldata', Existing URI: 'jr://file-csv/services.csv', Duplicate type: 'choice', Duplicate URI: 'None', Duplicate context: 'survey'.
I have tried by removing different fields as test_tool2.xlsx (13.1 KB) is working perfectly. I noticed that when I have removed row 33-35, the form gets converted without any issue.
Help will be highly appreciated.
Thanks,
Imran
Dear All,
Your help on this will be highly appreciated as at my end I tried my best and got stuck with the error during conversion.
Thanks in advance,
Imran
If you remove just choice_filter
column it will work so it happens if you use choice_filter
and pulldata
in the same form then the converter tries to add two instances with the same id. I think it's a bug but would be good to ask someone from pyxform @Ukang_a_Dickson
1 Like
Thank you @Grzesiek2010 for identifying the issue. @Ukang_a_Dickson, I would appreciate your support on this issue.
The pyxform issue is tracked at https://github.com/XLSForm/pyxform/issues/387.
@A.N.M_AL-IMRAN, since you don't have many procedure types, I don't think an external file for them is ideal. If you have 5 or fewer service types, you could just use an if
to get the duration (if service1
was selected, duration is 3 weeks, if service2
, duration is 5 weeks, etc).
Alternately, you can do the same kind of lookup @mathieubossaert suggested without using an external file but as you mentioned previously, there isn't explicit documentation around doing this. It will require writing an XPath query and I shared an example at Progress out of Poverty Index (PPI) tools - #14 by LN.
In your case, you could add a choice list called services
with an additional column called duration
. You would build your select_one
for ${fp_method_provided}
the same way you do now but without the search
appearance. The part that will likely look unfamiliar is the query to look up service_duration
. That will look something like instance(‘services’)/root/item[name=${fp_method_provided}]/duration
. This means "go to the services choice list, find the one where the service name matches the one selected at ${fp_method_provided}
and get me the duration."
See a complete form at fp_unmet_need_e-tracking_tool-hm20200506.xlsx (29.6 KB).
2 Likes
Dear @LN,
So clearly explained! Thank you so much for your help! Now it became a good reference for all as a workaround method without the need of an external sheet.
Thanks once again,
Imran
1 Like