Write a function

hi all

??? where can i write a new function then use it in any element.


Hi Rohlat,

Can you elaborate on what specifically you’re trying to do with this
You may find the following article helpful: CommCare Functions


Robin Selwitz

··· On Tue, Oct 18, 2016 at 3:52 AM, Sunrise wrote:

hi all

??? where can i write a new function then use it in any element.


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I want generat Unique ID for each case so i want write a function in Javascrept then use it in any element in commcare … can you help me in this issue ?


Unfortunately CommCare does not support using javascript to define form
logic. Currently there is also no way define your own custom XPath function
within the Form Builder on CommCareHQ.

If you want a unique id but don’t care about the exact format, then I would
suggest using uuid()
If you have a particular id format in mind, you can string together the
logic to construct that id using a series of hidden values that perform the
necessary string / numeric manipulations. I like to put all those hidden
values in the same group so that it is easy to copy that logic between

··· -- Phillip Mates Mobile Engineer at Dimagi

Thank you … i will try it