on 03-10-2008 3:43 PM
I have a node populated in my custom controller that contains key/value pair. I would like to put this in a drop down by key. I've gone wrong somewhere.
Context ---
CourseList
---Objid
---Stext
Layout contains
DropDownByKey
id=CourseListByKey
selectedKey=CourseList.Stext
Code to load the simple value set
IWDAttributeInfo attributeInfo = wdContext.nodeCourseList().getNodeInfo().getAttribute("Objid");
ISimpleTypeModifiable attribNameType = attributeInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = attribNameType.getSVServices().getModifiableSimpleValueSet();
// Clear previous data
valueSet.clear();
int nodeLength = wdContext.nodeEventtype_List().size();
for (int i = 0; i < nodeLength; i++)
{
valueSet.put(((IPrivateSelectionView.IEventtype_ListElement)(wdContext.nodeEventtype_List().getElementAt(i))).getObjid(),
((IPrivateSelectionView.IEventtype_ListElement)(wdContext.nodeEventtype_List().getElementAt(i))).getStext());
}
I am getting an error MappedAttributeInfo(SelectionView.CourseList.Objid): must not modify the datatype of a mapped attribute
Where am I going wrong?
Diane
Hi diane,
Your node is mapped from view to controller.So you cant modify the context attributes inside view.Thats why you are getting this message.Please use the same piece of code inside controller to resolve this issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I put the code that obtains the data and then builds the value set in the component controller. How do I get the value set over to the Selection view?
int nodeLength = wdContext.nodeEventtype_List().size();
for (int i = 0; i < nodeLength; i++)
{
valueSet.put(((IPrivateManagerMassRosterCust.IEventtype_ListElement)(wdContext.nodeEventtype_List().getElementAt(i))).getObjid(),
((IPrivateManagerMassRosterCust.IEventtype_ListElement)(wdContext.nodeEventtype_List().getElementAt(i))).getStext());
}
// Place valueset in context <==== the following is not functional
ICourseValueSetElement elemVS = wdContext.nodeCourseValueSet().createCourseValueSetElement();
elemVS.setValueSet(valueSet);
How do I get the value set over to the Selection view? My assumption is to build a node and element and then add the element to the node.
Diane
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 build the value set in component controller then add the same context node & attribute
in your selection view controller. And now map this to the component controller.
Now when you build the value set in component controller, it will also be reflected in the same attribute in selection view controller.
Regards,
Praveen
I've moved the code to create the valueset into the custom controller. I then have this node in both the view and custom controller the element is of type com.sap.typeservices.IModifiableSimpleValueSet. Now the view layout will not allow me to bind to the element.
I think I'm making this too hard. I mean all I'm wanting to do is take the results from a function module and put them in a drop down (piece of cake type coding from my .Net/C# days). Is there a tutorial, blog, or sample code from you that shows me how to build a drop down from data returned from a function module?
Getting a bit frustrated,
Diane
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
Place the code to load the simple value set in component controller....
Regards
Akshaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
I had the same problem before. Remove the mapping between the component controller and view controller for this node and attribute. Create a separate node in the view Controller itself and directly access it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You have two controller's and you are mapping the nodes between two.
(a) mapped node
(b) origin node
you are mapping your mapped node from one controller's context to origin node of other one.
This error is coming because you are modifying the attribute in mapped node. Two ways to avoid this problem.
(1). delete the mapping between the mapped node and origin node
(2). populate the value set in origin node
Regards,
Praveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If this attribute is inside a node mapped to some other (e.g. the component) controller, you have to modify the value set at the "mapping origin" node.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.