Write a function

hi all

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

best

Hi Rohlat,

Can you elaborate on what specifically you’re trying to do with this
function?
You may find the following article helpful: CommCare Functions
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions

Best,

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.

best


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.

Hi

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 ?

Hello,

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()
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-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
forms.

··· -- Phillip Mates Mobile Engineer at Dimagi

Thank you … i will try it