rsoesemann/visualforce-table-grid

Use of App with an inner SOQL query

Opened this issue · 0 comments

I have two Objects (Deal__c and Property__c) with a junction Object (Deal__Properties__c). I am attempting to use the app to pull data from selected Property fields based on the specific Deal Id. I can make the app work if I abandon the junction Object and place a field on the Property Object that looks up the Deal. The app is then as follows:
_<apex:page standardController="Deal__c">
<apex:form >

    <!-- Editable grid with customization turned on -->   
    <c:tableGrid type="Property__c" 
                 fields="Name, Asset_Type__c, Portfolio__c, Campus_Type__c, Market__c"
                 filter="Deal_to_Link__c = '{!Deal__c.Id}'"
                 sortBy="Asset_Type__c"
                 image="/img/icon/hands24.png"
                 sortDescending="true"
                 title="Properties" 
                 gridPageId="editable"
                 customizeFields="true"
                 customizeFilter="true"
                 saveSettings="true"
                 pageSize="25"
                 mode="list"/>                         
</apex:form>

</apex:page>_

This does work, but would either require manual maintenance of the Deal_to_Link field, or writing an Apex Trigger to populate the field. I then went back to using the Deal_Property junction object, and created a SOQL statement that returns the desired records:

SELECT
(SELECT Property__c, Property__r.Name, Property__r.Asset_Type__c, Property__r.Portfolio__c, Property__r.Campus_Type__c, Property__r.Market__r.Name
FROM Deal_Properties__r)
FROM Deal__c
WHERE Id = 'a06o000000EaLsT' I used a specific Deal Id to test.

My questions are: can this app be used with an inner SOQL statement (as shown above) and if so, what would the syntax be? Thanks.