Eval syntax for 'depends on'

Hi,

I’m trying to write a test for depends on box on a form customization. I can get simple == tests to work,but I need to test for a partial match on a field. How would I write an expression to test if a field starts with a particular value. For example I want to display the field if the item_name field start with ‘720-’.

Regards,

MarkW

Use eval:doc.item_name.substr(0,3)== “720”

3 Likes

Thanks for the reply, it seemed to work, but causes problems when trying to save the BoM item.

MarkW

Give some default value to the filed on which you are using substr function.
Like in this case item_name should have some default value, otherwise it will give error.

@mark1 Mention default value or you can write like this eval:doc.item_name && doc.item_name.substr(0,3)=="720"

1 Like