Display fields can be a powerful tool, when displaying custom information on a form or a report. But there are times when a form has information from multiple tables being returned as part of the form query that is needed within a display field calculation.
To maximize the performance of the system you need to cache display fields, but this means you need to write your display methods efficiently to maximize system performance.
When writing display methods you have two options, write them on the form, or the database. Where possible I recommend you write them on the the database, but there are times when this is not possible.
When you write a display method on a form you have the option to include one parameter, a table. So for example if you have a display field on an InventSum table, you would pass the InventSum _InventSum parameter into the display field.
Within the code of the display field you can get to the other tables contained within the query, using joinchild and joinparent.
In the example below I have two tables, InventSum and InventDim, where InventSum is passed into the display field, but I also want access to information from InventDim.
display xyz displaymethod(InventSum _InventSum)
localInventDim = _InventSum.joinchild();
<do some code here>
The above will allow you to navigate down the query to the necessary table you are interested in extracting the information from.
If you wanted to traverse down more tables then you can simple use the joinchild from the return joinchild previously. So in the above case you would use <table> = localInventDim.joinChild();