Forgot to mention that if you have a couple of places where you have the
same problem, it might be good idea to subclass CSpComboBox and add a
method 
select(java.lang.String) which will do what the code below does.

Aby

-----Original Message-----
From: Aby Mathew [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 10, 1999 1:47 PM
To: 'Curt Springer'; Shamdasani Nimmi-ANS004; 'NetDynamics'
Subject: Re: [ND] FW: [ND] Trying to use setValue for a Combobox with
the concatena tion of d atafields


I got curious about what was going on and did some research. I am pretty
convinced that there is a bug (may be two) in ND.

My conclusions:

1. If you have selected Emp Name and Emp id as the value for the combo,
the value is constructed as "John, 1234". While
combo.getSelected().getValue() correctly gives "John, 1234",
combo.getValue() returns "John,1234" (takes out the space after ,)

2. combo.select(CSpValue) fails even after the above glitch is taken
care of. I guess the culprit is none but the implementation of
select(CSpValue).

I could get going with the following piece of code.
======================================================================
                Enumeration enum = combo.getChildren().elements();
                int count = 0;
                while (enum.hasMoreElements()) {
                        CSpSelectable sel = (CSpSelectable)
enum.nextElement();
                        if
(sel.getValue().toString().equals(myDesiredString))
                                break;
                        else  {
                        CSpHtml.sendMessage("Val :
|"+sel.getValue()+"|<BR>");
                        count++;
                        }                       
                }
                combo.select(count);
======================================================================

Well, I was driven by curiosity. Otherwise I would have used a computed
column in the DataObject where Oracle would have neatly concatenated the
fields and given one field to ND.


Aby


Oh, OK, now I get it.

Don't know the answer, but here's a way to find out:

theBox.doAutoFill();
theBox.selectAll();
Vector v = theBox.getSelectedList();
for(Enumeration e=v.elements(); e.hasMoreElements();)
{
  CSpListItem currSelected=(CSpListItem) e.nextElement();
              String   currSelectedLabel=currSelected.getLabel ();
              CSpValue currSelectedValue=currSelected.getValue ();
CSpLog.send(this, CSpLog.ERROR, "label ="+currSelectedLabel + ", value="
+ 
currSelectedValue);
}//for(Enumeration e=v.elements(); e.hasMoreElements();)

-- Curt, Team ND


At 01:20 PM 9/10/99 -0500, Shamdasani Nimmi-ANS004 wrote:
>No Curt, I want to select only one entry except that entry value is
made up
>if 2 data fields.
>
> >-----------------------------------------------------------------
> >public int
>
>MCSC2_NETWORK_ELEMENTS_FK_SW_RECORD_ID_onBeforeDisplayEvent(CSpDisplayE
vent
> >event)
> >{
> >
> >         CSpComboBox theBox = (CSpComboBox) event.getSource();
> >
> >         theBox.removeAllChildren(true);
> >
> >         CSpSelect theDO = (CSpSelect)
> >CSpider.getDataObject("doSoftwareReleaseList");
> >
> >         theDO.clearDynamicCriteria();
> >
> >
>
> > >
> > >Hi All,
> > >
> > >My Combobox value is made up of 2 data fields. When I try to use
> > >ComboBox.setValue with the concatenation of the two datafields it
does
>not
> > >work. I have tried it different ways e.g.,:
> > >
> > >Just concatenating the two data fields.
> > >
> > >Putting a comma between the two fields to be concatenated.
> > >
> > >But nothing seems to work. Does anyone have an answer to this
problem?
> > >
> > >Thanks
> > >
> > >-Nimmi
> >
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to