I had this code:
[DataSource]
class FiscalDocument_BR
{
public void init()
{
super();
this.query().dataSourceTable(tableNum(FiscalDocument_BR)).clearDynalinks();
this.query().dataSourceTable(tableNum(FiscalDocument_BR)).addDynalink(
fieldNum(FiscalDocument_BR, Voucher),
GeneralJournalEntry,
fieldNum(GeneralJournalEntry, SubledgerVoucher));
}
}
But the client found a potential bug and I had to change this query to work like something like (this query works as intended):
SELECT * FROM GeneralJournalEntry
INNER JOIN FiscalDocument_BR ON
GeneralJournalEntry.SUBLEDGERVOUCHER = FiscalDocument_BR.VOUCHER OR
GeneralJournalEntry.SUBLEDGERVOUCHER = FiscalDocument_BR.InventoryVoucher OR
GeneralJournalEntry.SUBLEDGERVOUCHER = FiscalDocument_BR.CancelVoucherId OR
GeneralJournalEntry.SUBLEDGERVOUCHER = FiscalDocument_BR.CancelInventoryVoucherId
WHERE SUBLEDGERVOUCHER IN ('E001-20001314', 'E001-10020552')
I haven't found a option to use dynalink with multiple parameters and using dynalink multiple times is also not working since I need to use "OR" operator.
I've also tried to use range with no success:
[DataSource]
class FiscalDocument_BR
{
public void init()
{
super();
this.query().dataSourceTable(tableNum(FiscalDocument_BR)).addRange(Fieldnum(FiscalDocument_BR, RecId)).value(
strFmt('((%1.%2 == %3.%4) || (%1.%2 == %3.%5) || (%1.%2 == %3.%6) || (%1.%2 == %3.%7))'
, this.query().dataSourceTable(tablenum(GeneralJournalEntry)).name()//1
, fieldStr(GeneralJournalEntry, SubledgerVoucher)//2
, this.query().dataSourceTable(tablenum(FiscalDocument_BR)).name()//3
, fieldStr(FiscalDocument_BR, Voucher)//4
, fieldStr(FiscalDocument_BR, InventoryVoucher)//5
, fieldStr(FiscalDocument_BR, CancelVoucherId)//6
, fieldStr(FiscalDocument_BR, CancelInventoryVoucherId)));//7
}
}
How can I edit this code in order to replicate this sql query?
Thanks in advance.