on 03-28-2005 12:38 PM
Hello,
Let's say my contects contains a node called unit which contains one attribute called unitName. If I want to remove from Context all the previously elements from this node before I add new element how do I do that?
well it is simple procedure normally it should work ok
may be try wdcontext.curentnodename.setattribute("");
try to set the attribute which is bind with that combo.
I do not know ur node structure, the node which u invalidate is the same node which contains attribute which is bind with first combo?
yasir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I tried out your scenario. I'll brief what I have done.
I created two dropdown boxes.. Mapped it to two context attrbutes not context nodes.These attributes have been bound to two simple types.
The attributes are dept and size.
when I select shirt as the dept,I get 32 as size.
when i select T-shirt as dept, I get XXL as size.
The code is as follows
public void onActionSelect( wdEvent )
{
if(wdContext.currentContextElement().getDept().equals("Shirt")){
IWDAttributeInfo info=wdContext.getNodeInfo().getAttribute("size");
ISimpleTypeModifiable simpletype=info.getModifiableSimpleType();
IModifiableSimpleValueSet value=simpletype.getSVServices().getModifiableSimpleValueSet();
value.clear();
value.put("32","32");
}else{
IWDAttributeInfo info=wdContext.getNodeInfo().getAttribute("size");
ISimpleTypeModifiable simpletype=info.getModifiableSimpleType();
IModifiableSimpleValueSet value=simpletype.getSVServices().getModifiableSimpleValueSet();
value.clear();
value.put("XXL","XXL");
}
}
Please check the same and do revert for any clarifications.
Do send in your feedbacks
Regards
Noufal
Hi,
Just as Noufal has said you should clear the value set .You can also check whether the value set contains any elements using isEmpty().You are invalidating the node and entering new values based on the selection in the first combo.then you are actually appending to the valueset.
Regards
Rohit.R.Krishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you want to manually delete the attributes right click on contect node and delete the attributes you are intended to delete and add fresh attributes..
(hope this what you are looking for)
Regards,
RK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Let the scenario be as follows.
shirt->39,40,42
T-shirt-M,L,XL
Let the first node be itemnode->attribute item
Let the second node be categorynode- attribute size
if(wdcontext.currentatemnode.getitem.equals("T-shirt")){
wdcontext.nodecategorynode().invalidate();
//now set the values for the category node
}
This is just a brief example hope would help.
Regards
Noufal
hi,
you can do wdcontext.nodename.invalidate();
i hope this is waht u are looking for....
Regards
Yasir Noman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Yasir,
I'm not sure, let me describe you my problem:
I have a combo box which contains departments list and another combo which contains it's related departments.
Whenever the user changes the department at the first combo an event raises which should get the related departments and put them at the second combo.
The code for the event looks like this:
public void onActionchangeUnitByLocation(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionchangeUnitByLocation(ServerEvent)
String selectedLocation = wdContext.currentLocationElement().getLocationName();
String filter = new String("(& (sAMAccountName=*) (mojHebFirstName=*) (physicalDeliveryOfficeName=" + selectedLocation + ") (department=*))");
NamingEnumeration results = getLdapResults(filter);
// Clear Previous Unit Elements in case there are any
wdContext.nodeUnit().invalidate();
// Create New Unit Element
IPrivateParametersView.IUnitElement newUnitElement = wdContext.createUnitElement();
ISimpleTypeModifiable unitType = wdThis.wdGetAPI().getContext().getModifiableTypeOf("unit.unitName");
IModifiableSimpleValueSet unitValues = unitType.getSVServices().getModifiableSimpleValueSet();
int i = 0;
while(results.hasMoreElements())
{
try
{
SearchResult result = (SearchResult)results.nextElement();
Attributes attributes = result.getAttributes();
String department = attributes.get("department").get(0).toString();
unitValues.put(department,department);
i++;
}
catch (NamingException e)
{
e.printStackTrace();
}
}
// Add elements to the Context
wdContext.nodeUnit().addElement(newUnitElement);
wdContext.currentContextElement().setLastName("I is: " + i);
//@@end
}
The problem is that the combo box still contains previous results and doesn't "clean". The i integer is for debugging purpose. What could be the problem here?
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.