You need to sign in to do that
Don't have an account?
Nested SOQL question
Hi,
I need to retrieve some data using a nested SOQL, but I can't get the needed data. The SOQL is the following:
SELECT (SELECT Name, Unit_Price__c, Quantity__c, Time__c FROM Valitut_Tuotteet__r) FROM Service_Reservation__c WHERE Room_Reservation__c =: roomRes
I need to extract the Name, Unit_Price__c, Quantity__c and Time__c and show them on a table (apex:repeat). Do you have any idea of how can I access that data?
Using <apex:repeat> and retrieving the fields doesn't work, I guess is because the data structure that the query creates is not a simple List<Service_Reservation__c>.
Any idea on this?
Greetings,
MGA.
The SOQL query will return a list of Service_Reservation__c objects, but each of those will contain a nested list of Valitut_Tuotteet__c objects.
Thus you'll need to iterate the nested list. Something like the following:
All Answers
The SOQL query will return a list of Service_Reservation__c objects, but each of those will contain a nested list of Valitut_Tuotteet__c objects.
Thus you'll need to iterate the nested list. Something like the following:
Hi bob,
As usual, you are right :)
Many thanks,
MGA.
Thank you very much for this! Enjoy the Kudos.
I was trying to figure out how to access this data for much too long!