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
Jugbeer BholaJugbeer Bhola 

Object List within an Object

Hello, I have an Object with a list inside of of it. The two values I want to retrieve are 'Label' and 'Link.'  How do I get those values.  The error messages keep telling me I need an SObject.  The Object is not an SObject.  Looks something like this.

Link:[Label=FirstButton,Link=https://www.here.com],[Label=SecondButton,Link=https://www.there.com]
I want to get the value of 'Label' and 'Link' 
List<Object> OuterTable = new List<Object>();
OuterTable = response.LTable;
        for (Integer i=0;i<OuterTable.size();i++) { 
            System.debug('OK Until here' + OuterTable.get(i));   
//Don't know how to get the rest
}
Any help would be appreciated.

Thanks! 
 
Best Answer chosen by Jugbeer Bhola
FearNoneFearNone
Hi Jugbeer,

probably like this:
List<Object> OuterTable = new List<Object>();
OuterTable = response.LTable;
        for (Object obj : OuterTable) { 
            for (Link link : obj.Link) {
                for (Label label : link.Label) {
                    System.debug(label);
                }
            }
        }

 

All Answers

NimitNimit
Can you please describe in detail what you are trying to achieve..
FearNoneFearNone
Hi Jugbeer,

probably like this:
List<Object> OuterTable = new List<Object>();
OuterTable = response.LTable;
        for (Object obj : OuterTable) { 
            for (Link link : obj.Link) {
                for (Label label : link.Label) {
                    System.debug(label);
                }
            }
        }

 
This was selected as the best answer
Jugbeer BholaJugbeer Bhola
Your answer gave me direction.  I just had to instantiate the object from the source class and mess around.  This is what the answer turned out to be.  Thanks!
aIntegraionLinks.GetLinkTableResponseType_elementFuture tableToRecieve = (aIntegraionLinks.GetLinkTableResponseType_elementFuture)state;
  		integraionLinks.LinkTable responseToRecieveTable  = tableToRecieve.getValue().LinkData;   
  		integraionLinks.LinkTable OuterTable;
                OuterTable = responseToRecieveTable;   
            		for (integraionLinks.Link  ot : OuterTable.LTable) {
                		String CaptionValue = ot.Caption;
                		String LinkValue = ot.LinkUrl;  
			}