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
LaaralLaaral 

how to query right in data loader

I have a problem which concerns exporting/updating data with data loader. I have a custom object Setup which has a Recurring fee related list. Now I'd have to update Date of Invoice and Created date information from Recuirring fee and these changes have to be made only to recuirring fees in certain Setups. I noticed I can't  query from both custom objects setup and recurring fee, so how could I link these two together? In Recurring fee there is a lookup field Setup__c which connects these two, but how can I query right these both objects with data loader?
Also what is right way to put date to data loader, I've selected from Setting European Time so what is the right way to write it ?! I've tried so many different things, but I can't understand what is the right way.  It's stated in SF this way 28.1.2014 12:49
Best Answer chosen by Laaral
Vinit_KumarVinit_Kumar
Try below 

<pre>
Select id from recurring_fee__c where setup__c in (select id from Setup__c where RecordType.name IN( 'infra','hardware' ) and cost_center__c = '001D000000qnf59')
</pre>

All Answers

Vinit_KumarVinit_Kumar
You should be doing something like below :-

<pre>
select Date_of_Invoice__c,CreatedDate from  Recurring_ fee__c where Setup__c ='<Id of related Setup record>'
</pre>

Also,you would not be able to update CreatedDate as this is Audit field.If you need to do that you have to log a case with support to get editing allowed on audti fields.

As per your ther question,the correct format for Date is YYYY-MM-DD (ex 2013-12-18)
LaaralLaaral
Could I so something like this in data loader? Select id from recurring_fee__c where setup__c in (select id from Setup__c where RecordType.name = 'infra' or recordType.name = 'hardware' and cost_center__c = '001D000000qnf59') ? now I'm geting an error which says that "Error at row 1 Column 139 expecting a right parentheses, found 'and', why can't I use and ?

Vinit_KumarVinit_Kumar
Try below 

<pre>
Select id from recurring_fee__c where setup__c in (select id from Setup__c where RecordType.name IN( 'infra','hardware' ) and cost_center__c = '001D000000qnf59')
</pre>
This was selected as the best answer
LaaralLaaral
That seemed to work , but when I noticed I have many cost center's it's giving and error that Error at row 1:column:199: expecting a right parantheses, found ','  . Can't I use  multiple cost centers if the query is cost_center__c = ? 
Select id, name, date_of_invoice__c, createddate from recurring_fee__c where setup__c in (select id from Setup__c where RecordType.name IN( 'infra','hardware' ) and cost_center__c = '001D000000qnf59','001D000000s3NM9','001D000000rT9FI','001D000000u4hoR','001D0000011CH54','001D0000011lzqK')
LaaralLaaral
Now I've got it I did this
Select id, name, date_of_invoice__c from recurring_fee__c where
setup__c in (select id from Setup__c where RecordType.name IN( 'infra','hardware' )
and cost_center__c.groupid = '0012000000AK643')
What if in one setup there are 3 recurring fees but I want to only update the latest? Should I do a group by setup__c?