In a form like LedgerJournalTransDaily, there is a field Txt imported from LedgerJournalTrans. Using the JournalNum, I need to go to LedgerJournalTable and get the Name field.
I've written a display method like follows:
[SysClientCacheDataMethodAttribute(true)]
public display Name GetLedgerJournalTableName()
{
LedgerJournalTable ledgerJournalTable;
Name ret;
select firstFast firstOnly ledgerJournalTable
where ledgerJournalTable.JournalNum == this.JournalNum;
ret = ledgerJournalTable.Name;
return ret;
}
To be honest, I am not sure if this is fast enough or if there is another way to do it. Please give me a hint.
If performance is a concern, you could try to add the LedgerJournalTable
as read only datasource to the form with OnlyFetchActive = Yes
, join it with the LedgerJournalTrans
data source and add the Name
field of the new data source to the form design.
But if the journals do not have hundreds of lines and there is no performance problem yet, I would go with the display method. You can always change it later if it becomes a problem and a display method is less invasive than a new data source.
For further reading, take a look at Tutorial: Caching display methods by Ivan Kashperuk.