what actually happens
when we give
1)a!textField(
label:"First Name",
value:ri!emp.firstName,
saveInto:ri!emp.firstName
)
2)a!textField(
value:index(ri!emp,"firstName",null),
or
value:property(ri!emp,"firstName",null),
in what scenario's we need to use first one / second one...
Discussion posts and replies are publicly visible
index() and property() have the same functionality. You use index() or property() to access a field which is not guaranteed to exist. Like in a nested CDT as rule input with some parts being null.
From a functional perspective, there is not difference between the three options.
Does that answer your question?
yup, Mostly..,what is preferrable mostly...,either using ri!emp.firstName/index..? in value:
If your rule input is flat (no nesting) then use dot-notation, else index()/property(). In general, if you know that the field is ALWAYS available, use dot-notation. If there is a slight chance that the field does not exist, then use index().
As Stefan mentioned, index() and property() have the same functionality. For code clarity, though, I *STRONGLY* recommend people use property() when fetching a dot property, and reserve index() for fetching an index (i.e. a position within an array). Hence their names. I make this a required 'best practice' in all projects I lead.
Great, Thank you
Thank you