Expand my Community achievements bar.

SOLVED

Accessor Unknown Error

Avatar

Level 1

Hello all,

I'm getting an "accessor unknown" error in LiveCycle, and I can't figure out why.  The error I'm getting is, "Error: accessor 'end_disposition_string' is unknown."  As far as I can tell, this is generally caused by referencing a variable that hasn't been created, but I am creating "end_disposition_string" before I reference it. The error is in the object I'm showing the code for below, and I checked to make sure I have the language set to FormCalc.

Any idea what I could be doing wrong? 

Thanks in advance for your help!

Snap1.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 7

Best practice is to declare your variables at the beginning of the script. You can include a comment line before hand like "//variables", but anyone reading your code should already know what you're doing there.

View solution in original post

4 Replies

Avatar

Level 7

It looks like a scope issue. You declared the variable end_disposition_string inside your if statement. Are you using that variable anywhere outside of that if statement? If you are, then that variable is out of scope, and you'll get that error message. Here's a short example of what I mean:

if (At($.rawValue,"ab" == 0)) then; This just gets us into the if statement

   var s = At ($,"cd") ; Here, I'm declaring 's'

endif ;Once I 'endif', any declared variable inside is discarded

TextField2.rawValue = s ;Now, when I try to set the value of TextField2, there is no 's'

I don't know for certain if that is your problem since you didn't include all of the code, but that's where I'd start looking. Is there more code for that object? What is the line number that is provided when the system throws that error?

Avatar

Level 1

Thank you!  That makes sense and is probably what I'm doing wrong.  I do use the variable outside of the "if" loop.  Unfortunately, I can't include the rest of the code, and the error message doesn't tell me which line the problem is on (it gives me "..." for the location).  Is there any way to make a variable stick outside of the if statement?

Avatar

Correct answer by
Level 7

Best practice is to declare your variables at the beginning of the script. You can include a comment line before hand like "//variables", but anyone reading your code should already know what you're doing there.

Avatar

Level 1

Thank you, thank you, thank you!  That should have been obvious, but it wasn't.  My issue is resolved.  Really appreciate the help!