web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Display Field using values from different tables

DaxNigel Profile Picture DaxNigel 2,574

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)
{
InventDim  locaInventDim;
localInventDim = _InventSum.joinchild();
<do some code here>
return result;
}

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();



This was originally posted here.

Comments

*This post is locked for comments