+ Start a Discussion
SL TanSL Tan 

Need Help on Select From Where Statement for S-Control


Hi
I hope someone can help me point to correct direction for this problem
Using Ajax Toolkit I have been able to successfully generate the results from the Select Statement below

sforce.connection.query("SELECT Id, Name, cmi__Selected_Color__c, cmi__Selected_Color_Qty_del__c,   cmi__Production_Order_No__r.Id, cmi__Production_Order_No__r.Name, (SELECT Id, Name, cmi__Color_Name__c, cmi__Ctn_Nos_Packed__c FROM R00N50000001cypTEAQ), (SELECT Id, Name, cmi__Color_Name__c, cmi__Ctn_Nos_Packed__c FROM R00N50000001cpNnEAI), (SELECT Id, Name, cmi__Color_Name__c, cmi__Ctn_Nos_Packed__c FROM R00N50000001cypOEAQ), (SELECT Id, Name, cmi__Color_Name__c, cmi__Ctn_Nos_Packed__c FROM R00N50000001cyDIEAY) FROM cmi__Packing_List__c",callback);

Packing List is the Master Object in question, Production Order No is the Parent, and
R00N50000001cypTEAQ,R00N50000001cpNnEAI,R00N50000001cypOEAQ,R00N50000001cyDIEAY
are the Child Objects.

In this case, one Production Order No (Parent) can have several Packing Lists (Master). What I tried to do using the WHERE clause is to get say if there are 6 Packing Lists associated with the Parent, I would like the result to show only this particular Parent Record with its data on the 6 Packing Lists and the associated Child Object information. Could someone please help me point out how the WHERE clause should be handled

I have tried this but it does not output any record -

WHERE cmi__Production_Order_No__r.Id='{!cmi__Packing_List__c.cmi__Production_Order_NoId__c}' AND cmi__Production_Order_No__r.Name='{!cmi__Packing_List__c.cmi__Production_Order_No__c}' ",callback);
Any advice would be highly appreciated
Thanks in advance

SL

Message Edited by SL Tan on 10-01-2007 06:56 PM