Select to view content in your preferred language

ODK validate error

1522
4
Jump to solution
03-14-2021 09:42 AM
LeoDeRuiter
Emerging Contributor

Hey there, 

Hoping someone can solve my issue! I am attempting to modify a survey that is linked to a workforce project. 

I keep getting the same ODK validate error. Wondering if anyone knows how to solve it! 

 

Attached is the error message and the XL file. 

0 Kudos
2 Solutions

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @LeoDeRuiter looks like there's an issue with the if() statement for the assignmentType question. An if() statement requires three arguments: a condition; the result if the condition is true; and the result if the condition is false, i.e. if(condition, value if true, value if false). The final false argument is missing (i.e. what to return if all conditions are false); also the parentheses need to enclose the whole if() statement in each case. Please try something like:

if(selected(${requestm}, "Yes"), 1, if(selected(${requestl}, "Yes"), 2, if(selected(${requestnm}, "Yes"), 3, if(selected(${requestnl}, "Yes"),4,''))))

Note the additional empty '' value for the final false argument.

An if() statement returns the first true argument, e.g. the requestm question is evaluated first, so if requestm = 'Yes' then assignmentType will be 1, regardless of the answers to the other three questions.

As a side note, please see this useful blog post by my colleague Josh Clifford regarding setting up Workforce assignments in Survey123.

Best, Jim

View solution in original post

LeoDeRuiter
Emerging Contributor

Thank you @Jim-Moore! Greatly appreciated! That seems to have worked! I am now wondering if there is anyway to create assignments that would not work in this way with the IF function is there any other way you would suggest? in order to effectively capture each assignment type  

Also, I am now getting an error message when attempting to publish this survey 


"Unable to add feature service layer definition" code: 400 [Not supported. Columns cannoe be added to view services]. I briefly looked up solutions and common issues associated with this error and cannot seem to the find the same errors as others have had previously associated with this error message


Wondering if you have any idea on how to fix this? 

Best, 

Leo

View solution in original post

0 Kudos
4 Replies
Jim-Moore
Esri Regular Contributor

Hi @LeoDeRuiter looks like there's an issue with the if() statement for the assignmentType question. An if() statement requires three arguments: a condition; the result if the condition is true; and the result if the condition is false, i.e. if(condition, value if true, value if false). The final false argument is missing (i.e. what to return if all conditions are false); also the parentheses need to enclose the whole if() statement in each case. Please try something like:

if(selected(${requestm}, "Yes"), 1, if(selected(${requestl}, "Yes"), 2, if(selected(${requestnm}, "Yes"), 3, if(selected(${requestnl}, "Yes"),4,''))))

Note the additional empty '' value for the final false argument.

An if() statement returns the first true argument, e.g. the requestm question is evaluated first, so if requestm = 'Yes' then assignmentType will be 1, regardless of the answers to the other three questions.

As a side note, please see this useful blog post by my colleague Josh Clifford regarding setting up Workforce assignments in Survey123.

Best, Jim

LeoDeRuiter
Emerging Contributor

Thank you @Jim-Moore! Greatly appreciated! That seems to have worked! I am now wondering if there is anyway to create assignments that would not work in this way with the IF function is there any other way you would suggest? in order to effectively capture each assignment type  

Also, I am now getting an error message when attempting to publish this survey 


"Unable to add feature service layer definition" code: 400 [Not supported. Columns cannoe be added to view services]. I briefly looked up solutions and common issues associated with this error and cannot seem to the find the same errors as others have had previously associated with this error message


Wondering if you have any idea on how to fix this? 

Best, 

Leo

0 Kudos
Jim-Moore
Esri Regular Contributor

Hi Leo

It looks like your survey could've been created initially in the Survey123 web designer, is that right? This error message can occur if the survey was first published in the web designer (which creates feature layer views) and you then add fields in Connect and attempt to republish. Please see this reply for some useful info on this.

Regarding creating assignments, the usual workflow (as described in Josh's blog post) is to create a survey in Connect from the Assignments feature layer that was created as part of the Workforce project. The survey would then be used to create one assignment per submission. Is your aim to have a survey that would create multiple Workforce assignments per submission? For this to work you would need the assignments layer to be a related table, so you could then use a repeat to capture and submit multiple assignments in the form; however, the Assignments feature layer in a Workforce project is the parent layer, so it wouldn't be possible to use a repeat for this layer. I also note from this reply that it's not possible to specify the feature layer for your Workforce project. Would it be feasible in your case to have a separate form for creating assignments?

Best, Jim

0 Kudos
LeoDeRuiter
Emerging Contributor

Hi Jim, 

Thanks for the response.  The survey was first created in Connect, unfortunately, it was created by esri as part of a solution  (Wellness Check Registry) and I am attempting to update it to capture some additional information as well as change the assignment type.  The solution outline is perfect for what i am trying to do but for the wrong purpose. If I am able to tweek it would be amazing. 

I am attempting to utilize two surveys one for assignments one for workers within workforce to manage them. 

 

Best, 

 

Leo 

I attempting 

0 Kudos