function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun BArun B 

SOQL help pls ..

Hello there,
I am quite new to Apex coding .. I got stuck while using some SOQL queries: Here is one:

Select s2.Product__c from spl_sample_object_items__c s2 where s2.Sample_Object__r.Name  in (Select Name from spl_sample_objects__c where Audit_Date__c  >=  2008-04-03 and Audit_Date__c  <= 2008-06-04)

spl_sample_objects__c -> master object
spl_sample_object_items__c - > detail object


The SOQL compiler is unable to understand the select statement in my subquery in where clause. I am unable to figure out the issue here. Is this query not feasible in SOQL ? Any help would be greatly appreciated !!



Arun B
Arun BArun B
Well after going through some posts I understood that the above is not feasilble in SOQL; Any work around suggestions ?
SuperfellSuperfell
Select Product__c from spl_sample_object_items__c where Sample_Object__r.Audit_Date__c >= 2008-04-03 and Sample_Object__r.Audit_Date__c
There's an excellent section in the API documentation on SOQL-R
Arun BArun B
Thanks for the response Simon. It really works well.

For the same requirement, I have one more question: I would need to execute 9 * 3 = 27 such queries(different where conditions) for a single action (flex button click) on the client side. Is it advisable to directly query the data using Apex.query or is there any better way to do this ? I am using Force.com toolkit for flex.Pls advise.



Thanks,
Arun B


Message Edited by Arun B on 06-08-2008 04:48 PM
SuperfellSuperfell
the basic rule of distributed computing is that round trips are evil, 27 round trips tied to a single user action doesn't seem that tenable to me. You could possibly write an apex webservice to run all your queries and return a single dataset to the client in one round trip, but it would depend on the particulars of what you're trying to do (and for the flex toolkit to support apex webservices, i don't know if it does or not)
Arun BArun B
Thanks for the response Simon. I will look into the alternatives !


Arun B