How can I prevent a case property like ID from being the same for two cases?

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see if you
can identify where the problem is with the setup I have done trying to
follow the tutorial.

The first attached picture is where I inserted in the first part to the XML.

Then I tried to implement the following into a hidden variable to see what
the result would be (true or
false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name])
= 0

where my case type is zika and the case property I am checking against is
the name and finally the field i'm checking is assigned_subject_id.

Finally, this is the error message I get when trying to build the form:

Validation Error: Problem with bind for /data/question1 contains invalid
calculate expression
[count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name])
= 0] Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

Hi Hakan,

Sorry for the confusion, that page had a typo on it.

instead of

#case/name

you should be checking for

#form/assigned_subject_id

making the final expression

count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=
#form/assigned_subject_id]) = 0

-Clayton

··· On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk wrote:

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see if you
can identify where the problem is with the setup I have done trying to
follow the tutorial.

The first attached picture is where I inserted in the first part to the
XML.

Then I tried to implement the following into a hidden variable to see what
the result would be (true or false): count(instance('
casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name])
= 0

where my case type is zika and the case property I am checking against is
the name and finally the field i'm checking is assigned_subject_id.

Finally, this is the error message I get when trying to build the form:

Validation Error: Problem with bind for /data/question1 contains invalid
calculate expression [count(instance('casedb')/
casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0]
Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

--
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.

That didn't seem to work. I created a patient with the ID 1231, and the
expression returned true. This is right because I had not created a patient
with that ID before. Next, I went to fill out the form again with 1231 as
the answer to the question again. The expression returned true, when it
should have returned false.

Do you know what could be causing this? Did I put the casedb xml in the
right place / could that be causing the issue?

··· On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote: > > Hi Hakan, > > Sorry for the confusion, that page had a typo on it. > > instead of > > #case/name > > you should be checking for > > #form/assigned_subject_id > > making the final expression > > > count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id= > #form/assigned_subject_id]) = 0 > > -Clayton > > On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk <hakan....@gmail.com > wrote: > >> I am using the following CommCare help page >> to >> prevent having multiple IDs entered. >> >> It doesn't seem to be working, so I thought I'd post here and see if you >> can identify where the problem is with the setup I have done trying to >> follow the tutorial. >> >> The first attached picture is where I inserted in the first part to the >> XML. >> >> Then I tried to implement the following into a hidden variable to see >> what the result would be (true or >> false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >> = 0 >> >> where my case type is zika and the case property I am checking against is >> the name and finally the field i'm checking is assigned_subject_id. >> >> Finally, this is the error message I get when trying to build the form: >> >> Validation Error: Problem with bind for /data/question1 contains invalid >> calculate expression >> [count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >> = 0] Couldn't understand the expression starting at this point: >> ...ned_subject_id=?#case/name]) =... in form >> >> Thanks for the help, >> >> Hakan Berk >> >> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Hakan,

Are you sure you are assigning the value assigned_subject_id to the case
when the form is saved/created and that the case type is assigned as *zika *
properly?

It would be helpful to look at HQ's Case Report and find the case you
created on the server with the ID 1231 and double check that those two
fields ended up correct.

-Clayton

··· On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk wrote:

That didn't seem to work. I created a patient with the ID 1231, and the
expression returned true. This is right because I had not created a patient
with that ID before. Next, I went to fill out the form again with 1231 as
the answer to the question again. The expression returned true, when it
should have returned false.

Do you know what could be causing this? Did I put the casedb xml in the
right place / could that be causing the issue?

On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote:

Hi Hakan,

Sorry for the confusion, that page had a typo on it.

instead of

#case/name

you should be checking for

#form/assigned_subject_id

making the final expression

count(instance('casedb')/casedb/case[@case_type='zika'][
assigned_subject_id=#form/assigned_subject_id]) = 0

-Clayton

On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk hakan....@gmail.com wrote:

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see if you
can identify where the problem is with the setup I have done trying to
follow the tutorial.

The first attached picture is where I inserted in the first part to the
XML.

Then I tried to implement the following into a hidden variable to see
what the result would be (true or false): count(instance('casedb
')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0

where my case type is zika and the case property I am checking against
is the name and finally the field i'm checking is assigned_subject_id.

Finally, this is the error message I get when trying to build the form:

Validation Error: Problem with bind for /data/question1 contains invalid
calculate expression [count(instance('casedb')/case
db/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0]
Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 attached three screenshots showing the setup. The case list shows that
two subjects with the same ID were created (look at 1234, I never finished
the form for the second 1231).

I also attached a screenshot showing "zika" as the case type, and
"assigned_subject_id" being set as the name of the case property.

While it does not detect the duplicate ID, the app at least now is able to
be built and deployed. But nonetheless, I was wondering if you could see
anything from those screenshots that would indicate why it isn't behaving
how it should.

Thanks,

Hakan

··· On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote: > > Hakan, > > Are you sure you are assigning the value *assigned_subject_id* to the > case when the form is saved/created and that the case type is assigned as *zika > *properly? > > It would be helpful to look at HQ's Case Report and find the case you > created on the server with the ID 1231 and double check that those two > fields ended up correct. > > -Clayton > > On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk <hakan....@gmail.com > wrote: > >> That didn't seem to work. I created a patient with the ID 1231, and the >> expression returned true. This is right because I had not created a patient >> with that ID before. Next, I went to fill out the form again with 1231 as >> the answer to the question again. The expression returned true, when it >> should have returned false. >> >> Do you know what could be causing this? Did I put the casedb xml in the >> right place / could that be causing the issue? >> >> On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote: >>> >>> Hi Hakan, >>> >>> Sorry for the confusion, that page had a typo on it. >>> >>> instead of >>> >>> #case/name >>> >>> you should be checking for >>> >>> #form/assigned_subject_id >>> >>> making the final expression >>> >>> >>> count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id= >>> #form/assigned_subject_id]) = 0 >>> >>> -Clayton >>> >>> On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk wrote: >>> >>>> I am using the following CommCare help page >>>> to >>>> prevent having multiple IDs entered. >>>> >>>> It doesn't seem to be working, so I thought I'd post here and see if >>>> you can identify where the problem is with the setup I have done trying to >>>> follow the tutorial. >>>> >>>> The first attached picture is where I inserted in the first part to the >>>> XML. >>>> >>>> Then I tried to implement the following into a hidden variable to see >>>> what the result would be (true or >>>> false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>> = 0 >>>> >>>> where my case type is zika and the case property I am checking against >>>> is the name and finally the field i'm checking is assigned_subject_id. >>>> >>>> Finally, this is the error message I get when trying to build the form: >>>> >>>> Validation Error: Problem with bind for /data/question1 contains >>>> invalid calculate expression >>>> [count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>> = 0] Couldn't understand the expression starting at this point: >>>> ...ned_subject_id=?#case/name]) =... in form >>>> >>>> Thanks for the help, >>>> >>>> Hakan Berk >>>> >>>> -- >>>> 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-user...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

I added another screenshot showing the validation condition and the app
preview and the fact that I don't have a patient with the ID of 1 and it is
still giving me errors (same with 12,123, 1234, etc) even tho I have two
patients already registered with 1234 for this mobile worker.

Hopefully this helps with figuring out what is going on.

Hakan

··· On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote: > > Hi, > > I attached three screenshots showing the setup. The case list shows that > two subjects with the same ID were created (look at 1234, I never finished > the form for the second 1231). > > I also attached a screenshot showing "zika" as the case type, and > "assigned_subject_id" being set as the name of the case property. > > While it does not detect the duplicate ID, the app at least now is able to > be built and deployed. But nonetheless, I was wondering if you could see > anything from those screenshots that would indicate why it isn't behaving > how it should. > > Thanks, > > Hakan > > > > On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote: >> >> Hakan, >> >> Are you sure you are assigning the value *assigned_subject_id* to the >> case when the form is saved/created and that the case type is assigned as *zika >> *properly? >> >> It would be helpful to look at HQ's Case Report and find the case you >> created on the server with the ID 1231 and double check that those two >> fields ended up correct. >> >> -Clayton >> >> On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk wrote: >> >>> That didn't seem to work. I created a patient with the ID 1231, and the >>> expression returned true. This is right because I had not created a patient >>> with that ID before. Next, I went to fill out the form again with 1231 as >>> the answer to the question again. The expression returned true, when it >>> should have returned false. >>> >>> Do you know what could be causing this? Did I put the casedb xml in the >>> right place / could that be causing the issue? >>> >>> On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote: >>>> >>>> Hi Hakan, >>>> >>>> Sorry for the confusion, that page had a typo on it. >>>> >>>> instead of >>>> >>>> #case/name >>>> >>>> you should be checking for >>>> >>>> #form/assigned_subject_id >>>> >>>> making the final expression >>>> >>>> >>>> count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id= >>>> #form/assigned_subject_id]) = 0 >>>> >>>> -Clayton >>>> >>>> On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk wrote: >>>> >>>>> I am using the following CommCare help page >>>>> to >>>>> prevent having multiple IDs entered. >>>>> >>>>> It doesn't seem to be working, so I thought I'd post here and see if >>>>> you can identify where the problem is with the setup I have done trying to >>>>> follow the tutorial. >>>>> >>>>> The first attached picture is where I inserted in the first part to >>>>> the XML. >>>>> >>>>> Then I tried to implement the following into a hidden variable to see >>>>> what the result would be (true or >>>>> false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>> = 0 >>>>> >>>>> where my case type is zika and the case property I am checking against >>>>> is the name and finally the field i'm checking is assigned_subject_id. >>>>> >>>>> Finally, this is the error message I get when trying to build the form: >>>>> >>>>> Validation Error: Problem with bind for /data/question1 contains >>>>> invalid calculate expression >>>>> [count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>> = 0] Couldn't understand the expression starting at this point: >>>>> ...ned_subject_id=?#case/name]) =... in form >>>>> >>>>> Thanks for the help, >>>>> >>>>> Hakan Berk >>>>> >>>>> -- >>>>> 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-user...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> 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-user...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>

Hi Hakan,

It looks like you're saving the assigned_subject_id to the name case
property. So the expression Clayton sent, I believe should be updated to
(note changing assigned_subject_id to case_name):

count(instance('casedb')/casedb/case[@case_type='zika'][case_name=
#form/assigned_subject_id]) = 0

Can you give that a try?

-Nick

Nick Nestle
Technical Project Manager | Dimagi Inc.

··· On Fri, Mar 31, 2017 at 9:42 PM, Hakan Berk wrote:

I added another screenshot showing the validation condition and the app
preview and the fact that I don't have a patient with the ID of 1 and it is
still giving me errors (same with 12,123, 1234, etc) even tho I have two
patients already registered with 1234 for this mobile worker.

Hopefully this helps with figuring out what is going on.

Hakan

On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote:

Hi,

I attached three screenshots showing the setup. The case list shows that
two subjects with the same ID were created (look at 1234, I never finished
the form for the second 1231).

I also attached a screenshot showing "zika" as the case type, and
"assigned_subject_id" being set as the name of the case property.

While it does not detect the duplicate ID, the app at least now is able
to be built and deployed. But nonetheless, I was wondering if you could see
anything from those screenshots that would indicate why it isn't behaving
how it should.

Thanks,

Hakan

On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote:

Hakan,

Are you sure you are assigning the value assigned_subject_id to the
case when the form is saved/created and that the case type is assigned as *zika
*properly?

It would be helpful to look at HQ's Case Report and find the case you
created on the server with the ID 1231 and double check that those two
fields ended up correct.

-Clayton

On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk hakan....@gmail.com wrote:

That didn't seem to work. I created a patient with the ID 1231, and the
expression returned true. This is right because I had not created a patient
with that ID before. Next, I went to fill out the form again with 1231 as
the answer to the question again. The expression returned true, when it
should have returned false.

Do you know what could be causing this? Did I put the casedb xml in the
right place / could that be causing the issue?

On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote:

Hi Hakan,

Sorry for the confusion, that page had a typo on it.

instead of

#case/name

you should be checking for

#form/assigned_subject_id

making the final expression

count(instance('casedb')/casedb/case[@case_type='zika'][
assigned_subject_id=#form/assigned_subject_id]) = 0

-Clayton

On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk hakan....@gmail.com wrote:

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see if
you can identify where the problem is with the setup I have done trying to
follow the tutorial.

The first attached picture is where I inserted in the first part to
the XML.

Then I tried to implement the following into a hidden variable to see
what the result would be (true or false): count(instance('casedb
')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) =
0

where my case type is zika and the case property I am checking
against is the name and finally the field i'm checking is
assigned_subject_id.

Finally, this is the error message I get when trying to build the
form:

Validation Error: Problem with bind for /data/question1 contains
invalid calculate expression [count(instance('casedb')/case
db/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0]
Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.

Hey Nick,

Thanks for giving your input on this, but it still doesn't seem to be
working with the given expression. I screenshotted the validation condition
for the question that should be not be allowing me to enter 1234 as an ID
since a user already has that ID. The expression should return false, but
instead is returning true.

Do you know what could be causing this to still not turn to false when I
enter in 1234?

Thanks for the help,

Hakan

··· On Monday, April 3, 2017 at 12:56:04 PM UTC-4, Nick Nestle wrote: > > Hi Hakan, > > It looks like you're saving the assigned_subject_id to the name case > property. So the expression Clayton sent, I believe should be updated to > (note changing assigned_subject_id to case_name): > > count(instance('casedb')/casedb/case[@case_type='zika'][*case_name*= > #form/assigned_subject_id]) = 0 > > Can you give that a try? > > -Nick > > > > > > Nick Nestle > Technical Project Manager | Dimagi Inc. > > > > On Fri, Mar 31, 2017 at 9:42 PM, Hakan Berk <hakan....@gmail.com > wrote: > >> I added another screenshot showing the validation condition and the app >> preview and the fact that I don't have a patient with the ID of 1 and it is >> still giving me errors (same with 12,123, 1234, etc) even tho I have two >> patients already registered with 1234 for this mobile worker. >> >> Hopefully this helps with figuring out what is going on. >> >> Hakan >> >> On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote: >>> >>> Hi, >>> >>> I attached three screenshots showing the setup. The case list shows that >>> two subjects with the same ID were created (look at 1234, I never finished >>> the form for the second 1231). >>> >>> I also attached a screenshot showing "zika" as the case type, and >>> "assigned_subject_id" being set as the name of the case property. >>> >>> While it does not detect the duplicate ID, the app at least now is able >>> to be built and deployed. But nonetheless, I was wondering if you could see >>> anything from those screenshots that would indicate why it isn't behaving >>> how it should. >>> >>> Thanks, >>> >>> Hakan >>> >>> >>> >>> On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote: >>>> >>>> Hakan, >>>> >>>> Are you sure you are assigning the value *assigned_subject_id* to the >>>> case when the form is saved/created and that the case type is assigned as *zika >>>> *properly? >>>> >>>> It would be helpful to look at HQ's Case Report and find the case you >>>> created on the server with the ID 1231 and double check that those two >>>> fields ended up correct. >>>> >>>> -Clayton >>>> >>>> On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk wrote: >>>> >>>>> That didn't seem to work. I created a patient with the ID 1231, and >>>>> the expression returned true. This is right because I had not created a >>>>> patient with that ID before. Next, I went to fill out the form again with >>>>> 1231 as the answer to the question again. The expression returned true, >>>>> when it should have returned false. >>>>> >>>>> Do you know what could be causing this? Did I put the casedb xml in >>>>> the right place / could that be causing the issue? >>>>> >>>>> On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote: >>>>>> >>>>>> Hi Hakan, >>>>>> >>>>>> Sorry for the confusion, that page had a typo on it. >>>>>> >>>>>> instead of >>>>>> >>>>>> #case/name >>>>>> >>>>>> you should be checking for >>>>>> >>>>>> #form/assigned_subject_id >>>>>> >>>>>> making the final expression >>>>>> >>>>>> >>>>>> count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id= >>>>>> #form/assigned_subject_id]) = 0 >>>>>> >>>>>> -Clayton >>>>>> >>>>>> On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk wrote: >>>>>> >>>>>>> I am using the following CommCare help page >>>>>>> to >>>>>>> prevent having multiple IDs entered. >>>>>>> >>>>>>> It doesn't seem to be working, so I thought I'd post here and see if >>>>>>> you can identify where the problem is with the setup I have done trying to >>>>>>> follow the tutorial. >>>>>>> >>>>>>> The first attached picture is where I inserted in the first part to >>>>>>> the XML. >>>>>>> >>>>>>> Then I tried to implement the following into a hidden variable to >>>>>>> see what the result would be (true or >>>>>>> false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>>>> = 0 >>>>>>> >>>>>>> where my case type is zika and the case property I am checking >>>>>>> against is the name and finally the field i'm checking is >>>>>>> assigned_subject_id. >>>>>>> >>>>>>> Finally, this is the error message I get when trying to build the >>>>>>> form: >>>>>>> >>>>>>> Validation Error: Problem with bind for /data/question1 contains >>>>>>> invalid calculate expression >>>>>>> [count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>>>> = 0] Couldn't understand the expression starting at this point: >>>>>>> ...ned_subject_id=?#case/name]) =... in form >>>>>>> >>>>>>> Thanks for the help, >>>>>>> >>>>>>> Hakan Berk >>>>>>> >>>>>>> -- >>>>>>> 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-user...@googlegroups.com. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>>> 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-user...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Hakan,

Could you try syncing your user on App Preview and seeing if this error
still occurs? This could be a bug that we encountered recently that should
be fixed shortly.

Cheers,
Will

··· On Mon, Apr 3, 2017 at 8:20 PM, Hakan Berk wrote:

Hey Nick,

Thanks for giving your input on this, but it still doesn't seem to be
working with the given expression. I screenshotted the validation condition
for the question that should be not be allowing me to enter 1234 as an ID
since a user already has that ID. The expression should return false, but
instead is returning true.

Do you know what could be causing this to still not turn to false when I
enter in 1234?

Thanks for the help,

Hakan

On Monday, April 3, 2017 at 12:56:04 PM UTC-4, Nick Nestle wrote:

Hi Hakan,

It looks like you're saving the assigned_subject_id to the name case
property. So the expression Clayton sent, I believe should be updated to
(note changing assigned_subject_id to case_name):

count(instance('casedb')/casedb/case[@case_type='zika'][case_name=
#form/assigned_subject_id]) = 0

Can you give that a try?

-Nick

Nick Nestle
Technical Project Manager | Dimagi Inc.

On Fri, Mar 31, 2017 at 9:42 PM, Hakan Berk hakan....@gmail.com wrote:

I added another screenshot showing the validation condition and the app
preview and the fact that I don't have a patient with the ID of 1 and it is
still giving me errors (same with 12,123, 1234, etc) even tho I have two
patients already registered with 1234 for this mobile worker.

Hopefully this helps with figuring out what is going on.

Hakan

On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote:

Hi,

I attached three screenshots showing the setup. The case list shows
that two subjects with the same ID were created (look at 1234, I never
finished the form for the second 1231).

I also attached a screenshot showing "zika" as the case type, and
"assigned_subject_id" being set as the name of the case property.

While it does not detect the duplicate ID, the app at least now is able
to be built and deployed. But nonetheless, I was wondering if you could see
anything from those screenshots that would indicate why it isn't behaving
how it should.

Thanks,

Hakan

On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote:

Hakan,

Are you sure you are assigning the value assigned_subject_id to the
case when the form is saved/created and that the case type is assigned as *zika
*properly?

It would be helpful to look at HQ's Case Report and find the case you
created on the server with the ID 1231 and double check that those two
fields ended up correct.

-Clayton

On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk hakan....@gmail.com wrote:

That didn't seem to work. I created a patient with the ID 1231, and
the expression returned true. This is right because I had not created a
patient with that ID before. Next, I went to fill out the form again with
1231 as the answer to the question again. The expression returned true,
when it should have returned false.

Do you know what could be causing this? Did I put the casedb xml in
the right place / could that be causing the issue?

On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote:

Hi Hakan,

Sorry for the confusion, that page had a typo on it.

instead of

#case/name

you should be checking for

#form/assigned_subject_id

making the final expression

count(instance('casedb')/casedb/case[@case_type='zika'][
assigned_subject_id=#form/assigned_subject_id]) = 0

-Clayton

On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk hakan....@gmail.com wrote:

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see
if you can identify where the problem is with the setup I have done trying
to follow the tutorial.

The first attached picture is where I inserted in the first part to
the XML.

Then I tried to implement the following into a hidden variable to
see what the result would be (true or false): count(instance('casedb
')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name])
= 0

where my case type is zika and the case property I am checking
against is the name and finally the field i'm checking is
assigned_subject_id.

Finally, this is the error message I get when trying to build the
form:

Validation Error: Problem with bind for /data/question1 contains
invalid calculate expression [count(instance('casedb')/case
db/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0]
Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.

Hey Will,

What is happening now is that when I set the case name to 1234, the hidden
variable that checks it is set to false (which is now correct), yet the
validation condition is still true.

Yet, the second screenshot shows when I then enter 12345, the validation
condition now goes off telling me to enter a unique ID when 12345 is a
unique ID.

I mean I guess I can just bring up the question again based on the hidden
variable, but it would be nice if the validation condition was working as
expected.

Do you know what would cause the validation condition to not trigger
correctly, but the hidden variable to trigger correctly?

Thanks,

Hakan

··· On Tuesday, April 4, 2017 at 4:04:41 AM UTC-4, William Pride wrote: > > Hakan, > > Could you try syncing your user on App Preview and seeing if this error > still occurs? This could be a bug that we encountered recently that should > be fixed shortly. > > Cheers, > Will > > On Mon, Apr 3, 2017 at 8:20 PM, Hakan Berk <hakan....@gmail.com > wrote: > >> Hey Nick, >> >> Thanks for giving your input on this, but it still doesn't seem to be >> working with the given expression. I screenshotted the validation condition >> for the question that should be not be allowing me to enter 1234 as an ID >> since a user already has that ID. The expression should return false, but >> instead is returning true. >> >> Do you know what could be causing this to still not turn to false when I >> enter in 1234? >> >> Thanks for the help, >> >> Hakan >> >> On Monday, April 3, 2017 at 12:56:04 PM UTC-4, Nick Nestle wrote: >>> >>> Hi Hakan, >>> >>> It looks like you're saving the assigned_subject_id to the name case >>> property. So the expression Clayton sent, I believe should be updated to >>> (note changing assigned_subject_id to case_name): >>> >>> count(instance('casedb')/casedb/case[@case_type='zika'][*case_name*= >>> #form/assigned_subject_id]) = 0 >>> >>> Can you give that a try? >>> >>> -Nick >>> >>> >>> >>> >>> >>> Nick Nestle >>> Technical Project Manager | Dimagi Inc. >>> >>> >>> >>> On Fri, Mar 31, 2017 at 9:42 PM, Hakan Berk wrote: >>> >>>> I added another screenshot showing the validation condition and the app >>>> preview and the fact that I don't have a patient with the ID of 1 and it is >>>> still giving me errors (same with 12,123, 1234, etc) even tho I have two >>>> patients already registered with 1234 for this mobile worker. >>>> >>>> Hopefully this helps with figuring out what is going on. >>>> >>>> Hakan >>>> >>>> On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote: >>>>> >>>>> Hi, >>>>> >>>>> I attached three screenshots showing the setup. The case list shows >>>>> that two subjects with the same ID were created (look at 1234, I never >>>>> finished the form for the second 1231). >>>>> >>>>> I also attached a screenshot showing "zika" as the case type, and >>>>> "assigned_subject_id" being set as the name of the case property. >>>>> >>>>> While it does not detect the duplicate ID, the app at least now is >>>>> able to be built and deployed. But nonetheless, I was wondering if you >>>>> could see anything from those screenshots that would indicate why it isn't >>>>> behaving how it should. >>>>> >>>>> Thanks, >>>>> >>>>> Hakan >>>>> >>>>> >>>>> >>>>> On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote: >>>>>> >>>>>> Hakan, >>>>>> >>>>>> Are you sure you are assigning the value *assigned_subject_id* to >>>>>> the case when the form is saved/created and that the case type is assigned >>>>>> as *zika *properly? >>>>>> >>>>>> It would be helpful to look at HQ's Case Report and find the case you >>>>>> created on the server with the ID 1231 and double check that those two >>>>>> fields ended up correct. >>>>>> >>>>>> -Clayton >>>>>> >>>>>> On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk wrote: >>>>>> >>>>>>> That didn't seem to work. I created a patient with the ID 1231, and >>>>>>> the expression returned true. This is right because I had not created a >>>>>>> patient with that ID before. Next, I went to fill out the form again with >>>>>>> 1231 as the answer to the question again. The expression returned true, >>>>>>> when it should have returned false. >>>>>>> >>>>>>> Do you know what could be causing this? Did I put the casedb xml in >>>>>>> the right place / could that be causing the issue? >>>>>>> >>>>>>> On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote: >>>>>>>> >>>>>>>> Hi Hakan, >>>>>>>> >>>>>>>> Sorry for the confusion, that page had a typo on it. >>>>>>>> >>>>>>>> instead of >>>>>>>> >>>>>>>> #case/name >>>>>>>> >>>>>>>> you should be checking for >>>>>>>> >>>>>>>> #form/assigned_subject_id >>>>>>>> >>>>>>>> making the final expression >>>>>>>> >>>>>>>> >>>>>>>> count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id= >>>>>>>> #form/assigned_subject_id]) = 0 >>>>>>>> >>>>>>>> -Clayton >>>>>>>> >>>>>>>> On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk wrote: >>>>>>>> >>>>>>>>> I am using the following CommCare help page >>>>>>>>> to >>>>>>>>> prevent having multiple IDs entered. >>>>>>>>> >>>>>>>>> It doesn't seem to be working, so I thought I'd post here and see >>>>>>>>> if you can identify where the problem is with the setup I have done trying >>>>>>>>> to follow the tutorial. >>>>>>>>> >>>>>>>>> The first attached picture is where I inserted in the first part >>>>>>>>> to the XML. >>>>>>>>> >>>>>>>>> Then I tried to implement the following into a hidden variable to >>>>>>>>> see what the result would be (true or >>>>>>>>> false): count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>>>>>> = 0 >>>>>>>>> >>>>>>>>> where my case type is zika and the case property I am checking >>>>>>>>> against is the name and finally the field i'm checking is >>>>>>>>> assigned_subject_id. >>>>>>>>> >>>>>>>>> Finally, this is the error message I get when trying to build the >>>>>>>>> form: >>>>>>>>> >>>>>>>>> Validation Error: Problem with bind for /data/question1 contains >>>>>>>>> invalid calculate expression >>>>>>>>> [count(instance('casedb')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name]) >>>>>>>>> = 0] Couldn't understand the expression starting at this point: >>>>>>>>> ...ned_subject_id=?#case/name]) =... in form >>>>>>>>> >>>>>>>>> Thanks for the help, >>>>>>>>> >>>>>>>>> Hakan Berk >>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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-user...@googlegroups.com. >>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>> 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-user...@googlegroups.com. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>> 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-user...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

Hi Hakan,

That is odd behaviour, I wonder if it's something to do with Web Apps and
not the logic. What happens if you type 123456? Maybe the validation
condition isn't firing until after the next digit is entered.

Could you reply directly to me at nnestle@dimagi.com (not the
commcare-users group) with the link to the form you are using so I could
have a look?

-Nick

Nick Nestle
Technical Project Manager | Dimagi Inc.

··· On Tue, Apr 4, 2017 at 7:54 AM, Hakan Berk wrote:

Hey Will,

What is happening now is that when I set the case name to 1234, the hidden
variable that checks it is set to false (which is now correct), yet the
validation condition is still true.

Yet, the second screenshot shows when I then enter 12345, the validation
condition now goes off telling me to enter a unique ID when 12345 is a
unique ID.

I mean I guess I can just bring up the question again based on the hidden
variable, but it would be nice if the validation condition was working as
expected.

Do you know what would cause the validation condition to not trigger
correctly, but the hidden variable to trigger correctly?

Thanks,

Hakan
On Tuesday, April 4, 2017 at 4:04:41 AM UTC-4, William Pride wrote:

Hakan,

Could you try syncing your user on App Preview and seeing if this error
still occurs? This could be a bug that we encountered recently that should
be fixed shortly.

Cheers,
Will

On Mon, Apr 3, 2017 at 8:20 PM, Hakan Berk hakan....@gmail.com wrote:

Hey Nick,

Thanks for giving your input on this, but it still doesn't seem to be
working with the given expression. I screenshotted the validation condition
for the question that should be not be allowing me to enter 1234 as an ID
since a user already has that ID. The expression should return false, but
instead is returning true.

Do you know what could be causing this to still not turn to false when I
enter in 1234?

Thanks for the help,

Hakan

On Monday, April 3, 2017 at 12:56:04 PM UTC-4, Nick Nestle wrote:

Hi Hakan,

It looks like you're saving the assigned_subject_id to the name case
property. So the expression Clayton sent, I believe should be updated to
(note changing assigned_subject_id to case_name):

count(instance('casedb')/casedb/case[@case_type='zika'][case_name=
#form/assigned_subject_id]) = 0

Can you give that a try?

-Nick

Nick Nestle
Technical Project Manager | Dimagi Inc.

On Fri, Mar 31, 2017 at 9:42 PM, Hakan Berk hakan....@gmail.com wrote:

I added another screenshot showing the validation condition and the
app preview and the fact that I don't have a patient with the ID of 1 and
it is still giving me errors (same with 12,123, 1234, etc) even tho I have
two patients already registered with 1234 for this mobile worker.

Hopefully this helps with figuring out what is going on.

Hakan

On Saturday, April 1, 2017 at 12:31:54 AM UTC-4, Hakan Berk wrote:

Hi,

I attached three screenshots showing the setup. The case list shows
that two subjects with the same ID were created (look at 1234, I never
finished the form for the second 1231).

I also attached a screenshot showing "zika" as the case type, and
"assigned_subject_id" being set as the name of the case property.

While it does not detect the duplicate ID, the app at least now is
able to be built and deployed. But nonetheless, I was wondering if you
could see anything from those screenshots that would indicate why it isn't
behaving how it should.

Thanks,

Hakan

On Friday, March 31, 2017 at 5:40:01 PM UTC-4, Clayton Sims wrote:

Hakan,

Are you sure you are assigning the value assigned_subject_id to
the case when the form is saved/created and that the case type is assigned
as *zika *properly?

It would be helpful to look at HQ's Case Report and find the case
you created on the server with the ID 1231 and double check that those two
fields ended up correct.

-Clayton

On Fri, Mar 31, 2017 at 5:24 PM, Hakan Berk hakan....@gmail.com wrote:

That didn't seem to work. I created a patient with the ID 1231, and
the expression returned true. This is right because I had not created a
patient with that ID before. Next, I went to fill out the form again with
1231 as the answer to the question again. The expression returned true,
when it should have returned false.

Do you know what could be causing this? Did I put the casedb xml in
the right place / could that be causing the issue?

On Friday, March 31, 2017 at 4:03:48 PM UTC-4, Clayton Sims wrote:

Hi Hakan,

Sorry for the confusion, that page had a typo on it.

instead of

#case/name

you should be checking for

#form/assigned_subject_id

making the final expression

count(instance('casedb')/casedb/case[@case_type='zika'][
assigned_subject_id=#form/assigned_subject_id]) = 0

-Clayton

On Fri, Mar 31, 2017 at 3:40 PM, Hakan Berk hakan....@gmail.com wrote:

I am using the following CommCare help page
https://confluence.dimagi.com/display/commcarepublic/General+Workflow+Suggestionsto
prevent having multiple IDs entered.

It doesn't seem to be working, so I thought I'd post here and see
if you can identify where the problem is with the setup I have done trying
to follow the tutorial.

The first attached picture is where I inserted in the first part
to the XML.

Then I tried to implement the following into a hidden variable to
see what the result would be (true or false): count(instance('casedb
')/casedb/case[@case_type='zika'][assigned_subject_id=#case/name])
= 0

where my case type is zika and the case property I am checking
against is the name and finally the field i'm checking is
assigned_subject_id.

Finally, this is the error message I get when trying to build the
form:

Validation Error: Problem with bind for /data/question1 contains
invalid calculate expression [count(instance('casedb')/case
db/case[@case_type='zika'][assigned_subject_id=#case/name]) = 0]
Couldn't understand the expression starting at this point:
...ned_subject_id=?#case/name]) =... in form

Thanks for the help,

Hakan Berk

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.