Not able to use dynamic data in intent expression and well as for url

1. What is the issue? Please be detailed.
I am trying to use two features but not succeeding in any. First, i am trying to pass a select_one field's value as a part of the intent string eg. select_one farmer_mobile_number -> farmer_mobile_number and using this farmer_mobile_number i am passing it in the ex:android.intent.action.DIAL(uri_data='tel:${farmer_mobile_number}') but it is dialing some random arbitary values in the dialer.
Secondly, i am also using a select_one datatype to select the lat,long of a place, and want to redirect it to google maps, using url appearnace, but there also it is not concatinating with the field. eg. select_one farm_location -> farm_location, i am using this value of farm_location in the url's default like, concat('https://maps.google.com?q=',${farm_location}), still it is not getting appended. I have tried both join as well as concat, but nothing seems to help.

2. What steps can we take to reproduce this issue?
As, i mentioned you can set a select_one field and try to use that field's value in your intent's appearance, similarly for url also you can try to concat the field's value with the link you want to get redirected.

3. What have you tried to fix the issue?
I tried using different approaches like using calculate datatype, and reading the value from it, and all but nothing seems to work.

4. Upload any forms or screenshots you can share publicly below.

Unfortunately URL values in web forms are not currently dynamic. Here's an alternative I've used: https://github.com/enketo/enketo-transformer/issues/47#issuecomment-1063230366

Using concat should work in Collect.

1 Like

Thanks for the reply, it worked. i was actually trying to set the value in the default column but it should be in the calculations coulmn.
Another problem i have is, how to do this for the intent action, i.e calling external app, there how can we pass other field's value?

here is what i am doing currently: ex:android.intent.action.DIAL(uri_data='tel:${mobile_number}') but it is not working and showing some random large number as shred in th above screenshot

Is this in ODK Collect? Launching applications from Android intents is not available in Enketo web forms.

You may need to build the uri_data value in a separate calculate with something like concat('tel:', ${mobile_number}). Could you please try that and report back? If that works we should update the documentation to make that clearer.

Here is a sample form that shows examples with uri_data.

Thank you so much. It worked.

1 Like