Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

web service returns [object Object] into Label

Avatar

Level 1
I can return webService calls into a data grid fine, but if i
try to bind a result to a Label or Text area i always get [object
Object]

returned. I can't figure out how to format them into their
proper text?



He is my string for the label

<mx:Label x="10" y="421"
text="{wsGetNames.getDetails.lastResult.lastName}"
id="LastName_txt"/>



If anyone has any help or ideas, it is appreciated.

thank you.



3 Replies

Avatar

Level 2
Sorry, there isn't enough information to determine exactly
what issue you're running into but I do have a few debugging
suggestions.



In you web service result handler, print out the results
which are returned from the server using the
trace(mx.utils.ObjectUtil.toString(myResultObject)) method. This
method will dump the object to flashlog.txt.



You could also try
{wsGetNames.getDetails.lastResult.lastName.toString()}



- Cathy

Avatar

Level 1
thanks for the reply Cathy.



I've now got my webservice returning the XML data properly
into a LIST by adding



resultFormat="object" into the webService operation. Then
adding



labelField="LASTNAME" into the LIST parameters.



Is it possible to do this for a LABEL or TEXT parameter?



thanks again.

Avatar

Level 2
If this is working successfully in a list where the
dataprovider is {wsGetNames.getDetails.lastResult} then you should
be able to user {wsGetNames.getDetails.lastResult.LASTNAME} for the
LABEL or TEXT parameter.