Expand my Community achievements bar.

SOLVED

Can access data (DataService) from mxml, cannot from actionscript... please help!

Avatar

Former Community Member
hi... i'm new in the flex world. I'm trying to integrate
fds+spring+hibernate. i was able to retrive data from a spring bean
that accesses a database throw hibernate. the only problem is i can
access the data on the arraycollection in the mxml code but not on
the action script, where it appears to be empty:







<mx:Application...>

<mx:Script>

<![CDATA[

....

ds.fill(pmrecordslist);

...



// this does NOT WORK

trace(pmrecordslist.getItemAt(0).linhaprod);

// empty ( 0 )

trace(pmrecordslist.length)

...



]]>

</mx:Script>



<mx:DataService id="ds" destination="pmrecord" ... >



// this WORKS

<mx:Label text="{pmrecordslist.getItemAt(0).linhaprod}
{pmrecordslist.getItemAt(0).estadopar}"/>



</mx:Application.>







any help would be excellent

thanks
1 Accepted Solution

Avatar

Correct answer by
Former Community Member
i found the problem ... i was not waiting for the result to
arrive. just needed to wait for the result event to happen.



thanks any way.

cheers :)

View solution in original post

2 Replies

Avatar

Level 2
write thsi code and check it

[Bindable]

public var pmrecordslist:ArrayCollection;



and before calling fill method

write this code

pmrecordslist=new ArrayCollection()

Avatar

Correct answer by
Former Community Member
i found the problem ... i was not waiting for the result to
arrive. just needed to wait for the result event to happen.



thanks any way.

cheers :)
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----