Hi to all,
trying to customize a form discussed here I create a if test in the calculation column. The idea is to calculate the current month and then retrieve planned value for the current station for this month from the choices sheet.
If face a problem which seems to be relative to the length of my expression.
this test is ok :
if((${mois}='01'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_01,
(if((${mois}='02'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_02,
(if((${mois}='03'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_03,
(if((${mois}='04'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_04,
(if((${mois}='05'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_05,
(if((${mois}='06'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_06,
(if((${mois}='07'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_07,
(if((${mois}='08'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_08,''
))
))
))
))
))
))
))
)
But when I try to add another test for September, Central rise an error :
if((${mois}='01'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_01,
(if((${mois}='02'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_02,
(if((${mois}='03'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_03,
(if((${mois}='04'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_04,
(if((${mois}='05'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_05,
(if((${mois}='06'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_06,
(if((${mois}='07'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_07,
(if((${mois}='08'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_08,
(if((${mois}='09'),instance('stations')/root/item[name=indexed-repeat(${station}, ${mesure}, position(..))]/mois_09,''
))
))
))
))
))
))
))
))
)
Here is the issue :
Le XLSForm n'a pas pu ĂȘtre converti : ODK Validate Errors:
>> Something broke the parser. See above for a hint.
Error evaluating field 'cotes_gestion' (${mesure}[1]/suivi_station[1]/niveaux[1]/cotes_gestion[1]): The problem was located in Calculate expression for ${cotes_gestion}
XPath evaluation: type mismatch
indexed-repeat(): parameter 2 must be a parent of the field in parameter 1
Caused by: org.javarosa.xpath.XPathTypeMismatchException: The problem was located in Calculate expression for ${cotes_gestion}
XPath evaluation: type mismatch
indexed-repeat(): parameter 2 must be a parent of the field in parameter 1
... 10 more
The following files failed validation:
${suivi_lagunes}.xml
Result: Invalid
If anyone has any idea... it would help me not to get crazy
Anyway I think I will create 12 calculate fields in my form and show the one corresponding to the current month to simplify it a little....
But I would like to understand the problem.