Hello!
I guess I have a fairly easy question, but I still require assistance...
I have to fill field with values, depending on current data in form, and for that I am writing display method, with select statement, that will fetch the data I need, but how do I get those values in that FORMS fields.
For better understanding, lets say I have from FORM and fields A, B, C, D
I need to fill field D (display method) with values depending on values in field C.
Thanks you for assistance!
*This post is locked for comments
If you write a display method on a form, you have to pass the current record as a parameter. For example, you get _table1 buffer and refer to the field as _table1.FieldC.
Note that you typically want display methods on tables, so you can use them in several forms and cache their values (which is important especially if you communicate with database inside the method).
Thank you!
That did work!
but still - if I write display method for datasource (not Table), how can I refer to fields current value?
Your example isn't clear to me, so let's assume that you have a table called Table1 with a field called FieldC.
Then write a display method on the table and refer to FieldC as this.FieldC. Do your magic and return some value from the method (which represents D). Bind a form control to this method and you're done.
Yes, I know about that - but how can I get the FIELD C value?
So, If I add the method to properties and write
Table table;
DataSourcetable dsTable;
select FIELD from table
where table.FIELD1 == dsTable.D; (will this be the fields D value in form ?)
Hi MrRobot,
For normal fields the properties DataSource and DataField are used.
To display a displaymethod you can use the properties DataSource and DataMethod. So the method name should be entered in the DataMethod property.
Make sure the display method is or defined on the table itself or a new method on the datasource.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156