Info
Content

Setting the value of Reserved Field Names


If you are trying to set the value of a field through PeopleCode and that field happens to be NAME then you will experience the following error when using the shortcut Rowset(Row).Record.Field.Value approach:

&rsExample(1).DERIVED.NAME.Value = "This will error";

Gives the following error when you try to validate/save PeopleCode:

Expression of type String is not an object reference. (2,48)

This is caused by PeopleCode getting confused with the fact that the Field class also has a property, Name. To get around this, use GetField to access the Field object and then set the value like this:

&rsExample(1).DERIVED.GetField(Field.NAME).Value = "This will work";

Other fields such as LABEL or VALUE in your record would give you a similar error given they are also properties of the Field class.

No Comments
Back to top