Isomorphic,
I have a list grid which fetches data from different tables with joins. I have a situation where the same table need to be joined multiple times with different aliases.
So for list grid we write fields with Aliases and define them as customSQL and then use 'customCriteriaFields' parameter for the OperationBinding to generate the appropriate whereClause.
Example:
In the above sample we define, A2.COUNTRY as custom field in the ds.xml file and include it in 'customCriteriaFields' for the operationBinding. We then put it in criteria.
It works fine with the query constructed on a ListGrid.
We generate chart by doing a fetch on the DataSource, which ignores the custom field in the constructed whereClause.
I see the following in the log:
1) Any reason why the behavior is different in both the cases and how to resolve it or is this a bug.
2) Is there any shortcoming in this approach of joining tables. I have been hearing a lot on 'includeFrom' feature in the forums. Can this be used when you have to join same table multiple times like in the case we have above. If yes, which would be the better approach, the one we have or the includeFrom approach.
Version: SC_SNAPSHOT-2012-01-17_v8.2p/Enterprise Deployment 2012-01-17
Thanks
I have a list grid which fetches data from different tables with joins. I have a situation where the same table need to be joined multiple times with different aliases.
So for list grid we write fields with Aliases and define them as customSQL and then use 'customCriteriaFields' parameter for the OperationBinding to generate the appropriate whereClause.
Example:
Code:
SELECT DB.ORIGIN, DB.DESTINATION, A1.COUNTRY ORIGIN_COUNTRY, A2.COUNTRY DESTINATION_COUNTRY, SUM(BOOKINGS) FROM DATATABLE DB, AIRPORT A1, AIRPORT A2 WHERE DB.ORIGIN = A1.AIRPORT AND DB.DEST=A2.AIRPORT AND DB.ORIG ='LHR' AND A2.COUNTRY='GB' GROUP BY DB.ORIGIN, DB.DESTINATION, A1.COUNTRY , A2.COUNTRY
It works fine with the query constructed on a ListGrid.
We generate chart by doing a fetch on the DataSource, which ignores the custom field in the constructed whereClause.
I see the following in the log:
Code:
=== 2012-02-15 16:15:15,363 [0-61] WARN DSRequest - In criteria, definition 'A2.COUNTRY' refers to a related DataSource ('A2') that does not exist. Ignoring this criteria entry.
2) Is there any shortcoming in this approach of joining tables. I have been hearing a lot on 'includeFrom' feature in the forums. Can this be used when you have to join same table multiple times like in the case we have above. If yes, which would be the better approach, the one we have or the includeFrom approach.
Version: SC_SNAPSHOT-2012-01-17_v8.2p/Enterprise Deployment 2012-01-17
Thanks
Comment