How is the QueryFetchMode changed...

Hi all,

We are trying to use the Collections customer pool to group customers, as the “pool criteria” is defined in [CustCollectionsPool].[QueryPacked], this is a container field, and we can use something like new Query(custCollectionsPool.QueryPacked) to parse the criteria out and get a query.

But, it seems the query obtained directly in this way is complex and different datasources have different fetch modes like 1:n and 1:1. In this end, the intention to directly use the query failed the tests.

I traced the way how this custCollectionsPool.QueryPacked is used and found the form of [CustCollectionsPoolsListPage], in the executeQuery() of datasource [CustTable], I found the following code:

//----------------- ‘block 1’-------------------------------------------
public void executeQuery()
{
this.query(element.addOriginalPoolQuery(listPageHelper.getCurrentPoolQuery())); //dump XML_01 at the beginning of element.addOriginalPoolQuery() method like ‘block 2’ below, as “listPageHelper.getCurrentPoolQuery()” is ultimately , after some steps, directly using the ‘custCollectionsPool.QueryPacked’ anyway

super();

info(strFmt(‘after processing XML is:-------------%1’, this.query().xml())); //dump XML_02 here

element.setButtonAccess();
element.setGridColumnLabels();
}

//----------------- ‘block 2’-------------------------------------------
public Query addOriginalPoolQuery(Query _query)
{

QueryBuildDataSource custTableDs;
QueryBuildDataSource custAgingDs;
QueryBuildDataSource custAgingLegalEntityDs;
QueryBuildDataSource originalCustAgingDs;
QueryBuildDataSource dirPartyPostalAddressViewDs;
QueryBuildDataSource custCollectionsContactDs;
QueryBuildDataSource contactPersonDs;
QueryBuildDataSource dirPartyTableContactDs;
QueryBuildDataSource dirPartyContactInfoViewDs;
QueryBuildRange agingRange;

//dump XML_01 here
info(strFmt(’_query passed in is: --------- %1’, _query.xml())); //dump XML_01 here

custTableDs = _query.dataSourceTable(tableNum(CustTable));

}

The dumped XML files are attached like xml_01 and xml_02 for your reference.

If we disregard line 100 and afterwards in xml_02, and compare with xml_01, we can find xml_02 has all the fetch modes set to 1:1 and
for “CustTable”, Dynamic is set to “No” and only 2 fields are included.



for “DirPartyTable”, Dynamic is set to “No” and only 2 fields are included.


In fact, this fetch modes set to 1:1 Matters, as the translated sql will be split into mutiple clauses if it’s not 1:1, due to the structure of the data sources.

After all, the direct use of “new Query(custCollectionsPool.QueryPacked)” won’t get us in the right way, unless set to 1:1.

My concern is, how does this form [CustCollectionsPoolsListPage] successfully change the 1:n to 1:1 at multiple connection places on the Query parsed out from custCollectionsPool.QueryPacked? I mean, even with the logic from class [CustCollectionsListPageHelper], I cannot figure out how this happened… And the Dynamic set to No, to only fetch a coupld of fiedls doesn’t happen by itself, another query is hidden somewhere?Anything related to the Kernel?

Any advice I should bare in mind for future use? I was on this for long hours and any ideas are welcome!

Thank you!

xml_01.xml (11.3 KB)xml_02.xml (17.7 KB)

I suspect that focusing on FetchMode is a red herring.

Can you please tell us more about the actual problem? The current description (“the intention to directly use the query failed the tests”) isn’t very specific.