• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extracting values from an ArrayList into String variables

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

thanks in advance...!
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Nitin Menon
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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..! ('')
 
Narender Reddy Soma
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic