Extracting values from an ArrayList into String variables
Nitin Menon
Ranch Hand
Joined: Jun 13, 2007
Posts: 76
posted
0
Hi,
I have an issue in my application.
I get a list of objects from a java class into an ArrayCollection variable in my action script page. The ArrayList consists of key value pairs which is used to display in a combo box. when one of the value is selected, i need to get the value into a String variable. Only then can I go for further processings and use the resultant string variable to fetch values from DB.
So, can anyone help me how to get the values from an arrayList into a String Variable.
An ArrayList of key value pairs? Do you mean this? Lists don't have keys, though they do have indices that are kind of like keys.
ArrayCollections can be keyed on a string value, but you presumably have int values in there if you created it from an ArrayList. Typically in Flex you just pass your data to the control as is and Flex will do the rest. Can we see the code you've tried?
Ooh..! I am sorry.
I just found out that that they were not key value pairs. It was in the format (Example) : [{"IND,India"},{"UK,United Kingdom"}, {"US,United States"}] and so on. The database had values stored in the
above format. These are displayed in a combo box.
Suppose I select one of them, i want it in a String variable. only then can i call a Java method which takes a string variable as its parameter.
This message was edited 1 time. Last update was at by Nitin Menon
Narender Reddy Soma
Greenhorn
Joined: Jun 05, 2010
Posts: 22
posted
0
Nitin Menon wrote:Ooh..! I am sorry.
I just found out that that they were not key value pairs. It was in the format (Example) : [{"IND,India"},{"UK,United Kingdom"}, {"US,United States"}] and so on. The database had values stored in the
above format. These are displayed in a combo box.
Suppose I select one of them, i want it in a String variable. only then can i call a Java method which takes a string variable as its parameter.
If you get associated ArrayCollection , and you want to get value as String. You have String Var in Flex ,what is the problem? You can happyly pass that into RemoteObject call . Did'nt I understood the issue correctly?
Nitin Menon
Ranch Hand
Joined: Jun 13, 2007
Posts: 76
posted
0
Narender Reddy Soma wrote:
If you get associated ArrayCollection , and you want to get value as String. You have String Var in Flex ,what is the problem? You can happyly pass that into RemoteObject call . Did'nt I understood the issue correctly?
But, my arrayCollection here receives a list of objects from a Java class..! ('')
This message was edited 2 times. Last update was at by Nitin Menon
Narender Reddy Soma
Greenhorn
Joined: Jun 05, 2010
Posts: 22
posted
0
Nitin Menon wrote:
Narender Reddy Soma wrote:
If you get associated ArrayCollection , and you want to get value as String. You have String Var in Flex ,what is the problem? You can happyly pass that into RemoteObject call . Did'nt I understood the issue correctly?
But, my arrayCollection here receives a list of objects from a Java class..! ('')
Ok, Let me put like this . Say for e.g, you are getting CustomerObject from server as result of call on remoteobject
Now, I hope you have a equivalent CustomerObject.as file with [RemoteClass(alias="blah.blah.CustomerObject")] for mapping javaobject to your .as object. Correct me if I am wrong?
Nitin Menon
Ranch Hand
Joined: Jun 13, 2007
Posts: 76
posted
0
Narender Reddy Soma wrote:
If you get associated ArrayCollection , and you want to get value as String. You have String Var in Flex ,what is the problem? You can happyly pass that into RemoteObject call . Did'nt I understood the issue correctly?
Yeah..! Thats also my scenario..! Also, i have a java method i've declared in my remote object tag in the mxml file. on result, i get a list of objects into an ArrayCollection variable. This arraycollection variable is supposed to be the data provider of the combo box.
This message was edited 1 time. Last update was at by Nitin Menon
subject: Extracting values from an ArrayList into String variables