|
29.08.2007, 16:30 | #1 |
Участник
|
axaptapedia: Display method
Источник: http://www.axaptapedia.com/Display_method
============== Summary: for description of [[display method]] go to [http://msdn2.microsoft.com/EN-US/library/aa595058.aspx MSDN] === Limitations === [[display method]] behaves line in an ordinary field but have some limitations: *it's data can not be chenged (use [[edit method]] inestead) *you can not fiter and sort by display method If you need to sort and filter by display method's data, there is a following workarounds 1. Replace a display method with an ordinary stored field 2. Replace a display method with inner joined table. The last is applicable if you have an often situation when display method simply returns a fielad value of the related table by '''mandatory''' field. for exmaple, you have a display method on the table named YourTable like the following: display EmplName emplName() { return EmplTable::find(this.EmplID).Name; } if YourTable.emplID is mandatory, you can use inner join instead of this display method: 1. Place additional datasource on your form for EmplTable. 2. Set [[LinkType property]] to 'InnerJoin' 3. Add 'Name' field of the created EmplTable datasource to your [[Grid control]] or ehanever else If your original datasouce is read only, your job is done. In other case, when you try to add a new record to the datasource, you will see an error about mandatory fields of EmplTable. This error occurs because Ax tries to save joined datasource. To prevent such behavoiur, you should 4. Overridde the [[write method]] of the EmplTable datasource with an empty implementation to prevent wtiting data to the table public void write() { // 'super' is commented out: // super(); } 5. Override the [[validateWrite method]] of this datasource to prevent error messages: public boolean validateWrite() { boolean ret; ; //ret = super(); ret = true; return ret; } Now you can filter and sort your datasource by employee full name. Источник: http://www.axaptapedia.com/Display_method
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|