Cannot assign True | Community
Skip to main content
ReluctantProgrammer
August 31, 2021
Solved

Cannot assign True

  • August 31, 2021
  • 2 replies
  • 2247 views

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

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kosta_Prokopiu1

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)


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

2 replies

Pulkit_Jain_
Adobe Employee
Adobe Employee
September 1, 2021

@reluctantprogrammer 

This thread looks similar to this one- https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-forms/null-not-working/td-p/419443# 

Please confirm if this one is different, can you review the inputs provided here.

ReluctantProgrammer
September 1, 2021

My apologies.  I totally overlooked it. This is the same issue.

Mayank_Gandhi
Adobe Employee
Adobe Employee
September 1, 2021

@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]."

Kosta_Prokopiu1
Adobe Employee
Adobe Employee
September 1, 2021

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.

ReluctantProgrammer
September 1, 2021

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)