Hello guys,
I'm creating a CoC on FormDataSource for my form LedgerJournalTable, it was supposed to filter the list on the grid based on the menu item calling the form. While it is works, I found from the original menu the grid list became "broken". As the LedgerJournalTable form is a General Journal, I found out, the filter no longer works means all journal not only Daily journal (journal type) listed there, also the option to filter Not Posted and Posted no longer works.
I created the CoC to be like this :
[ExtensionOf(FormDatasourceStr(LedgerJournalTable, LedgerJournalTable))]
final class ABC_FormLedgerJournalTable_Extension
{
public void ExecuteQuery()
{
if (this.formRun().args().menuItemName() == menuitemdisplaystr(ABC_Payments))
{
//get caller record
ABC_Table ABCTable = this.formRun().args().record();
ABC_Line ABCLine
QueryBuildDataSource qbdsLedgerJournalTrans;
//strInvoice = subStr(strInvoice,1, strLen(strLTrim(strRTrim(strInvoice)))-1);
//adding filter to datasource
qbdsLedgerJournalTrans = this.queryBuildDataSource().addDataSource(tableNum(LedgerJournalTrans));
qbdsLedgerJournalTrans.joinMode(JoinMode::ExistsJoin);
qbdsLedgerJournalTrans.relations(true);
while select ABCLine where ABCLine.DocNumber == ABCTable.DocNumber
{
qbdsLedgerJournalTrans.addRange(fieldnum(LedgerJournalTrans, MarkedInvoice)).value(queryvalue(ABCLine.InvoiceId));
}
}
next executeQuery();
}
}
What should I do here ? should I added else condition ? but to me seems odd since if the menu item is not what I specified (my custom menu item), the query will not even altered right ?
Please advice,
Thanks