Hello experts,
I am having duplicated records while adding two datasource of the table Dirpartycontactview on CustTable form, my aim is to have two string control added on a grid that will display the telephone and email of each client, these two values are both contained in the locator field, so for both datasources i have set the join source property to CustTable and the link type to Outer-join, i used the OnInitialized event handler of each datasource to add the ranges etc, the result is that i have like 20 of the same record or even more, if i remove one datasource it will work fine but then i won't be able to reference my second string control, somehow using these two datasource is messing things up. can you please show me what i am missing?
this one for the telephone field
[FormDataSourceEventHandler(formDataSourceStr(CustTable, DirPartyContactInfoViewTelephone), FormDataSourceEventType::Initialized)]
public static void DirPartyContactInfoViewTelephone_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
{
//FormRun formRun = sender.formRun() as FormRun;
FormDataSource DirPartyContactInfoViewTelephone_ds = sender;
Query q= DirPartyContactInfoViewTelephone_ds.query();
QueryBuildDataSource qbds = q.dataSourceTable(tableNum(DirPartyContactInfoView));
qbds.addLink(fieldNum(CustTable, party), fieldNum(DirPartyContactInfoView,Party));
QueryBuildRange qbr1 = qbds.addRange(fieldNum(DirPartyContactInfoView, Type));
qbr1.value(queryValue(LogisticsElectronicAddressMethodType::Phone));
QueryBuildRange qbr2 = qbds.addRange(fieldNum(DirPartyContactInfoView, IsPrimary ));
qbr2.value(queryValue(NoYes::Yes));
}
and this one for the address
[FormDataSourceEventHandler(formDataSourceStr(CustTable, DirPartyContactInfoViewTelephone), FormDataSourceEventType::Initialized)]
public static void DirPartyContactInfoViewTelephone_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
{
//FormRun formRun = sender.formRun() as FormRun;
FormDataSource DirPartyContactInfoViewTelephone_ds = sender;
Query q= DirPartyContactInfoViewTelephone_ds.query();
QueryBuildDataSource qbds = q.dataSourceTable(tableNum(DirPartyContactInfoView));
qbds.addLink(fieldNum(CustTable, party), fieldNum(DirPartyContactInfoView,Party));
QueryBuildRange qbr1 = qbds.addRange(fieldNum(DirPartyContactInfoView, Type));
qbr1.value(queryValue(LogisticsElectronicAddressMethodType::Phone));
QueryBuildRange qbr2 = qbds.addRange(fieldNum(DirPartyContactInfoView, IsPrimary ));
qbr2.value(queryValue(NoYes::Yes));
}