+ Reply to Thread
Results 1 to 4 of 4
This is a discussion on Where clause in Child Relationship Select statement? within the Salesforce Coding Discussions forums, part of the Salesforce category; This is what I'm trying to do. Select m.MyCompany__Seller__c, m.Id, (Select a.Id,
  1. #1
    jarrettcoggin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    14

    Where clause in Child Relationship Select statement?

    This is what I'm trying to do.

    Select m.MyCompany__Seller__c, m.Id, (Select a.Id, a.LastModifiedDate, a.ParentId From Attachments a where a.LastModifiedDate > 2009-06-17T14:20:19Z) from MyCompany__Quote__c m where m.Id = 'xxxxxxxxxxxxx'

    I'm trying to get an attachment that is new than a specified datetime but is based on an Id of the parent table. I keep getting this error.

    " Malformed Query: received ' ', expected ':' "

    And the position is telling me that it is on the first slash of the 6/17/2009 part.

    EDIT: This is for a SOQL call against the SF.com API.
    EDIT: Changed the time from 6/17/2009 2:20:19 PM to 2009-06-17T14:20:19Z.
    Last edited by jarrettcoggin; 07-23-2009 at 03:59 PM.

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    joins or relation queries can be tricky and some will just not work in PHP. The best advice I can give you is to write your query using one of two tools:

    1) the development tool add on for eclipse
    2) force.com explorer to build and test SOQL queries.

    You can them from Setup > Develop > Tools


    Sorry I cannot be more help here sir


    ~Mike

  3. #3
    jarrettcoggin is offline Junior Member
    Join Date
    Jul 2009
    Posts
    14
    I figured it out. For some reason when I was testing this, I saved the code, deleted it, saved it again, then rewrote it the exact same way and it worked. It no longer gives me that error. It didn't like the datetime format for some reason.

    I also found that the date time format must be in the following format:

    YYYY-MM-DDThh:mm:ssZ

    The Z can be changed to a time zone adjustment in the format of:

    YYYY-MM-DDThh:mm:ss+hh:mm

    YYYY-MM-DDThh:mm:ss+04:00
    YYYY-MM-DDThh:mm:ss-02:00

    The ISO format this was following is the ISO 8601 : 1988 (E). If you'd like more information on this from Salesforce, go here and search for Date Formats and Date Literals.

  4. #4
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Thank you sir for the information, that all helps!

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2