This post is machine-translated. The original post in german language can be found here.
These post applies to following version:
Axapta 3.0
Axapta 3.0
|
|
|
|
|
|
This post is machine-translated. The original post in german language can be found here.
These post applies to following version:
Axapta 3.0
|
If you want to control which of the fields on a form are editable, you can use the property allowEdit of the datasource fields. If you have large tables containing a lot of fields, this could be a time-consuming process.
So, if you have a form, where the user should only be able to edit one field - in particular case a field from table salesLine -, you could use the following code-example which should be included in the init-method of the datasource. The snippet disallows editing for all fields exept for one field.
{
sqlDictionary sqlDictionary;
;
super();
while select sqlDictionary
where sqlDictionary.tabId == tableNum(salesLine)
&& sqlDictionary.fieldId != 0
{
if(sqlDictionary.name != "dataareaid" &&
sqlDictionary.name != "recversion" &&
sqlDictionary.name != "recId"
)
{
salesline_ds.object(sqlDictionary.fieldId).allowEdit(false);
}
}
salesline_ds.object(fieldNum(salesLine, blocked)).allowEdit(true);
}
Tested in AX 3.0