Substr or slice function in depends_on

Hi,
I used eval:doc.mystring.slice(0,2)===“RA”
in BOM Item, but when I try to Insert a new record in BOM Item Table, it puts me on the home page (out from BOM) where all the modules are shown and on the console I receive an error on the console.

Uncaught TypeError: Cannot read property ‘slice’ of undefined

and when I use substr function then the error is:

Uncaught TypeError: Cannot read property ‘slice’ of undefined

Can anyone, please help

Clearly doc.mystring has no value.