Split String from an URL

Dear ODK community,

In ODK collect I need to take an answer and store it in two different
variables. The variables shall be calculated by spliting the answer at a
slash "/"

Hopefully someone can help me out !

substring-after is likely what you need, but you won't be able to use

substring-after(${your-url-field} , '/')

as there are other / in the string already (https://). Hopefully your URL has a known form, then you can make your target more specific, eg

substring-after(${your-url-field} , 'split-string-from-an-url/') would return 54822 from this thread URL string.

Edited to fix string/target order

dear @ahblake ,
Thank you for your support
Please, let Me be more specific :
my url is : https://webapps01/Home/Mag/kilo22072021123937363
my wish is to extract kilo22072021123937363 and save It in other fild.
in attached, an overview of the form
Regards

Ok, if your URL in field ${id_barcode}always begins with https://webapps01/Home/Mag/ and the part at the end that changes that you want is, for example kilo22072021123937363, then you can get that either as a calculate field, or with a calculate into a text field with;

substring-after(${id_barcode} , 'https://webapps01/Home/Mag/')

or even

substring-after(${id_barcode} , 'Mag/')

1 Like

Thank you very much

It is working perctly

1 Like