Haggis
3rd July 2002, 16:12
Afternoon

I have a session that uses a form to display data from a table. The table contains 3 main field. The first being an Item number. The second being an attribute code and the third being the attribute response. The form then displays the item number followed by 30 instances of the attribute code and its description. So it is in effect repeating the field for attribute code and response 30 times. We have a user that deals with certain attributes and needs to be able to modify them. However they should not be allowed to alter anything else. Is it possible to thus make the attribute response field Read only in instances where the Attribute code is a certain number and Read Write access where the attribute code is something else?

If each Attribute code had its own field I would be able to do it but as it repeats the field for each attribute I am a bit stuck.

Hope I made sense there with that explanation.

Thanks
Haggis

grzegorz
3rd July 2002, 16:25
I dont know if I understand you, so correct me if im wrong.

Are attribute code and attrribute description defined as repeating fields in your table? If yes, you can write something like this:
field.tixxx999.attrresponse:
before.input:
if tixxx999.atrcode(attr.element) = readonly.code then
attr.input = false
endif
Global variable attr.element stores element number (current array index) for repeating fields used on form.

FransG
3rd July 2002, 17:19
If you are using BaanERP then you should use the following commands:

disable.fields("<field.name>") to have a field inaccessable (read-only).
enable.fields("<field.name>") to have a field accessable.

You're also addressing multiple occurrences. So, it might look like this:
before.display.object:
if attribute.code = <number> then
|* Read only.
disable.fields("attribute.response", actual.occ)
else
|* Read/write access.
enable.fields("attribute.response", actual.occ)
endif
Hope this helps.

Haggis
3rd July 2002, 17:25
Thanks for the reply Fransg and Grzegorz

I think your solution Fransg should do the trick.

Cheers
Haggis