+ Reply to Thread
Results 1 to 3 of 3
This is a discussion on Parsing confusing results from a relationship query within the Salesforce Coding Discussions forums, part of the Salesforce category; Hi, I have a custom object, Logistics_Events__c, on which I have a
  1. #1
    bakum is offline Junior Member
    Join Date
    Jan 2008
    Posts
    4

    Parsing confusing results from a relationship query

    Hi,

    I have a custom object, Logistics_Events__c, on which I have a field, Onsite_Logistics_Contact__c which is itself a lookup to Contact. I also have another field on that object called Book_Delivery_Contact__c which is ALSO a lookup to Contact. In my query I need to return the Onsite Logistics Contact's name and the Book Delivery Contact's name.

    My query (below) works and returns the results (also below) I need but I'm not sure how to parse them. I see nothing in the result set that indicates which of the sobject->SOBJECT[x] is Onsite_Logisitcs_Contact__r, and which is Book_Delivery_Contact__r. THey're both simply of type=Contact.

    How do I differentiate them?

    Thanks!
    Bakum

    ~~~~~~~~~~~~~~~~~~
    MY QUERY:
    SELECT l.Id,
    l.Start_Date__c,
    Course__r.Name,
    Course__r.Version__c,
    Onsite_Logisitcs_Contact__r.Name,
    Book_Delivery_Contact__r.Name,
    FROM Logistics_Event__c l



    RESULTS:
    SObject Object
    (
    [type] => Logistics_Event__c
    [fields] => SimpleXMLElement Object
    (
    [Start_Date__c] => 2008-01-28
    )

    [Id] => a0KR0000000IAweMAG
    [sobjects] => Array
    (
    [0] => SObject Object
    (
    [type] => Course__c
    [fields] => SimpleXMLElement Object
    (
    [Name] => MTC
    [Version__c] => 1
    )

    )

    [1] => SObject Object
    (
    [type] => Contact
    [fields] => SimpleXMLElement Object
    (
    [Name] => Buddy Kelley
    )

    )

    [2] => SObject Object
    (
    [type] => Contact
    [fields] => SimpleXMLElement Object
    (
    [Name] => Mark Baker
    )

    )

    )

    )

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Bakum

    Sorry I am on vacation and did not see this post! I will respond to it as soon as I can sir


    ~Mike

  3. #3
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Have you tried your query in the Salesforce explorer to see if it returns what you are looking for and getting the expected results?

    That is what I use

+ 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