Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Cannot assign True

Avatar

Level 3

I am using Math.floor in the Exit action of a field  ((headwaterExistingMain10 is the field name) and this is the formula in Calculate action:

 

if (headFtExistingMain10.rawValue==null)
this.rawValue==null
else this.rawValue = (Math.round(hweFtMain10.rawValue*10)/10)+(Math.round(headFtExistingMain10.rawValue*10)/10)

 

and though the calculations work I'm getting this error message 

 

"illegal value: cannot assign 'True' to xfa[0].form[0].form1[0].page1[0].table1[0].row5[0].headwaterExistingMain10[0].#value[0].#float[0]."

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi @ReluctantProgrammer ,

hence your name 🙂 

I think the offender is the this.rawValue==null == is a comparator not an assignment. Here my guess at what you wanted to do:
if (headFtExistingMain10.rawValue == null) {
this.rawValue = null
} else {
this.rawValue = (Math.round(hweFtMain10.rawValue*10)/10)+(Math.round(headFtExistingMain10.rawValue*10)/10)
}

I think if headFtExistingMain10 is null also set this field to null, correct? Try this and see if that fixes it.

Kosta

View solution in original post

2 Replies

Avatar

Level 10

@ReluctantProgrammer Looks like a type mismatch between the object type and the value you are trying to set.

 

"illegal value: cannot assign 'True' to xfa[0].form[0].form1[0].page1[0].table1[0].row5[0].headwaterExistingMain10[0].#value[0].#float[0]."

Avatar

Employee

yes, and for me the hint lies in the #float[0]. You are trying to set a float field with the value True. Try 1 or 0 if that makes sense in your logic.

Avatar

Level 3

Thank you Kosta.  Being a novice I'm not sure where the "true" is defined in my formula....

 

if (headFtExistingMain10.rawValue==null)
this.rawValue==null
else this.rawValue = (Math.round(hweFtMain10.rawValue*10)/10)+(Math.round(headFtExistingMain10.rawValue*10)/10)

Avatar

Correct answer by
Employee

Hi @ReluctantProgrammer ,

hence your name 🙂 

I think the offender is the this.rawValue==null == is a comparator not an assignment. Here my guess at what you wanted to do:
if (headFtExistingMain10.rawValue == null) {
this.rawValue = null
} else {
this.rawValue = (Math.round(hweFtMain10.rawValue*10)/10)+(Math.round(headFtExistingMain10.rawValue*10)/10)
}

I think if headFtExistingMain10 is null also set this field to null, correct? Try this and see if that fixes it.

Kosta

Avatar

Level 3

Exactly!  😉

 

This is what I needed.  It's working great!

 

Thank you so much!!!