You got a questionable data model if the country names are not bundled 
with the same SOAP msg that has your country codes.

1) Is your Flex binary supposed to have hardcoded all the country names?
2) What happens if you have the server-side return you a country code 
that the client does not expect?

It seems to me that it is half dynamic.

Wouldn't your life be easier if the java WS just told you both the combo 
box label and the underlying country code, instead of just the country code?


Anyways, if you can't do anything about it and you have to work with 
what you got, another approach (in line with Tracy's idea) is to have a 
Dictionary whose keys are your country code and values are country 
names. The next fancy step would be the cache the dictionary into a 
SharedObject so that the next time the user uses the combo box control, 
previously known country code and country name pairs will be available 
to the user. Just some thoughts....



gan_sun2006 wrote:
>  
>
> Thanks to everyone for suggestions.
>
> I am having a combo in which the values are dynamically coming from DB 
> thru java WS. The case is, when i select a country for instance say 
> "India", the code for the corresponding selection "IN" is saved to the 
> DB thru java WS during SAVE action. When i retrieve the value in 
> future, I am given only the countrycode "IN". Using this code, I have 
> to show the countryname on label property of my combo. I am currently 
> looping thru the arraycol(dataprovider) for checking the code for "IN" 
> and setting the arraycol index to combo.selectedIndex. I cannot use 
> switch() here as the values are dynamic from DB.
>
> Is there any other better way of doing this...?
>
> Thanks in advance!!!
>
> Regards,
> Ganesh Sundar R.
>
> --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com>, Jeffry Houser <j...@...> wrote:
> >
> >
> > I started to give him a similar answer, but then realized he may be
> > talking about setting the selectedItem on the ComboBox. He mentioned he
> > already had a labelField which seems to be exactly what he needs for
> > display purposes without a complicated switch statement.
> >
> > Ganesh, if neither answer helps you, could you elaborate on the problem?
> >
> > Mark Lapasa wrote:
> > >
> > >
> > > look at combo boxes labelfunction
> > > the function will then inspect the countrycode and you'll have a nasty
> > > switch statement that will output the correct country name
> > >
> > > -mL
> > >
> > > gan_sun2006 wrote:
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I am using combobox for which the bound data is coming from an
> > > > arraycollection. My arraycollection has two properties called
> > > > countryname(labelField) and countrycode. When i submit my page, the
> > > > countrycode from my combo is saved to the DB. During retrieval I am
> > > > given only countrycode and not countryname.
> > > >
> > > > How can I show the equivalent countryname as selectedItem in my
> > > > combobox? Presently I am looping through the arraycollection and
> > > > showing the equivalent countyname. Is there any other way to do it?
> > > >
> > > > Any help is highly appreciated...
> > > >
> > > > Regards,
> > > > Ganesh Sundar R.
> > > >
> > > >
> > >
> > > Notice of confidentiality:
> > > The information contained in this e-mail is intended only for the use
> > > of the individual or entity named above and may be confidential.
> > > Should the reader of this message not be the intended recipient, you
> > > are hereby notified that any unauthorized dissemination, distribution
> > > or reproduction of this message is strictly prohibited. If you have
> > > received this message in error, please advise the sender immediately
> > > and destroy the e-mail.
> > >
> > >
> >
> > --
> > Jeffry Houser, Technical Entrepreneur
> > Adobe Community Expert: http://tinyurl.com/684b5h 
> <http://tinyurl.com/684b5h>
> > http://www.twitter.com/reboog711 <http://www.twitter.com/reboog711> 
> | Phone: 203-379-0773
> > --
> > Easy to use Interface Components for Flex Developers
> > http://www.flextras.com?c=104 <http://www.flextras.com?c=104>
> > --
> > http://www.theflexshow.com <http://www.theflexshow.com>
> > http://www.jeffryhouser.com <http://www.jeffryhouser.com>
> > --
> > Part of the DotComIt Brain Trust
> >
>
> 



Notice of confidentiality:
The information contained in this e-mail is intended only for the use of the 
individual or entity named above and may be confidential. Should the reader of 
this message not be the intended recipient, you are hereby notified that any 
unauthorized dissemination, distribution or reproduction of this message is 
strictly prohibited. If you have received this message in error, please advise 
the sender immediately and destroy the e-mail.

Reply via email to