This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
I'm wondering if it is possible in some way to pass the name of a (repository) field to a subroutine and in that subroutine do something with the actual field (i.e. make it readonly):
You can't use a subroutine but you can use a method routine. You can pass in the object to a method and have the method manipulate the object. If all objects will be of the same type use the approach in umSetReadOnly2 otherwise you could use the approach in umSetReadOnly where you receive a PRIM_OBJ and then check the type to see how you will set it to read only. Sounds like in your case you can use the umSetReadOnly2 approach but wanted to show that you can do more than just pass a single class type to a method.
Thanks for your input! I will try if that works for me. I was also considering using a keyed collection of fields (with the key being the name of the field).
I don't think your solutions works for me. I'm using a reusable part with some fields on it. Not every user can view and/or update the fields. I wanted to make a generic subroutine / mthroutine to determine if a passed field should be read-only or visible at all. The code below does not work.
I think you just need to change the class of the define_map in uSetField. It should be #PRIM_EVEF not #FIELDNAME.Visual. You can figure out the class to use by going to the Outline view. Right click on the fields and you will see the PRIM class for the fields is PRIM_EVEF. See the simplified code below.