cancel
Showing results for 
Search instead for 
Did you mean: 

Get a Value Help in Table from Dictionary Simple Type

Former Member
0 Kudos

Hi All,

I have created a simple type in Dictionary. With some Key and value pair. I want to display the OVS for a particular column. In that column all the values must come from this value help.

Can any bode suggest me the steps for doing that.. I am already having a document from <b>Bertram Ganz</b>, explaining the way for EVS+, but the problem in my case is that all the columns in my table are constructed dynamically.. So I am bit comfused how to proceed.

Kindly let me know the solution.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

SDN,

First, you don not need OVS, you need either SVS with DropDownByKey or EVS with InputField.

When you are creating dynamically columns you have to create cell editor as well. So just create DropDownByKey or InputField for corresponding attribute, bind selectedKey / value property to attribute and you will get SVS/EVS behavior automatically.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

I actually need a EVS with Input Field. Let me tell you what all I have done.

1) I have created a Simple type in Dictionary and added the required values in that.

2) Created a attribute in the context node of that <b>Dictionary Type</b>.

3) and next I have to write the code. This is the code snippet:


IWDAttributeInfo iWDInfoElements = (IWDAttributeInfo) itrElement.next();	
						
String columnID = "Operator_" +iWDInfoElements.getName();
IWDTableColumn operatorColl = (IWDTableColumn)view.createElement(IWDTableColumn.class,columnID);
String input = "Input_" +iWDInfoElements.getName();
IWDInputField inputField = (IWDInputField)view.createElement(IWDInputField.class,input);
String attributeName = IPrivatePlugFDTView.ITempElement.OPERATOR;
IWDAttributeInfo attributeInfo = wdContext.nodeTemp().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();
ISimpleValueSet valueset = simpleType.getSVServices().getValues();
					    
inputField.bindValue<b>(________what to bind here_____</b>);

operatorColl.setTableCellEditor(inputField);

IWDCaption iCapOperator = (IWDCaption) view.createElement(IWDCaption.class,null);
					  iCapOperator.setText("Operator");
operatorColl.setHeader(iCapOperator);
IWDTableColumn iTabColFinal = (IWDTableColumn) view.createElement(IWDTableColumn.class,null);

IWDInputField idk = (IWDInputField)view.createElement(IWDInputField.class,null);

idk.bindValue("NewElements."+iWDInfoElements.getName());
iTabColFinal.setTableCellEditor(idk);
IWDCaption iCapFinal = (IWDCaption) view.createElement(IWDCaption.class,null);
iCapFinal.setText(iWDInfoElements.getName());
iTabColFinal.setHeader(iCapFinal);
iTabFinal.addGroupedColumn(operatorColl);
iTabFinal.addGroupedColumn(iTabColFinal);

where this iterator, iterates on the node which has the table attributes.

Actually what exactly I have to achieve is to add each cloumn for OPERATOR in front of each column from node on which iterator is applied.

I hope you get my problem. If there is any clarification required then kindly revert back.

Regards

Former Member
0 Kudos

SDN,

Actually, what you need is just call:


inputField.bindValue(attributeInfo);

I preserve names of your variables.

VS

Former Member
0 Kudos

Hi Valery,

Thanks for the info.. I have solved the probelm, but then I was facing one more problem. Whatever changes I do in the first column which comes from Dictionary table was reflected in all the other tables.

Anyways I have solved that as well. Made a attribute dynamically and bind this attribute the dictionary type.

Now, I have few more issues in the same value help. I have to perform some function on the event of this selection from the value help. But I could not find the way to capture this event. I thought this is a Input field so I can capture the <b>onEnter</b>, event .. but that is not working for me.. I have to hit enter to get that event.. But actually I dont want that.

I want as soon as I select the value from the value help I can get the event and perform some function on this selection.

I hope you got my problem!! Try and give me some hints regarding this..

Regards

Former Member
0 Kudos

SDN,

There is no such event, so it is not possible to intercept selection is EVS.

However, you may wrap original attribute(s) with calculated "proxy" attribute(s) and expose this/these calculated attribute(s) via UI controls.

Now, whenever value changed from UI (either user input or EVS selection), generated "setter" method will be invoked, so you may apply your logic here.

In "getter" just return original attribute value.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

I really have no idea what are you talking about. Can you kindly explain this further. I would really appretiate if you could give me some code snippet for doing the same.

Till the time I am going through the same article I have mentioned earlier. That has some thing called Calculated attributes, <b>EVS+ and EVS+</b> (which I have read twice but still not aware how to do, and what exactly EVS and EVS++ is !!), I hope I could do something put of this..

Regards

Former Member
0 Kudos

SDN,

Suppose you have attribute named RatingAttr with type that has enumeration (Bad, Average, Good, Excellent, for ex).

1. Now, under the very same node where RatingAttr resides create attribute RatingAttrCalc.

2. In <b>Properties</b> window (where you have just selected type of attribute) you will see property <b>calculated</b> that is <b>false</b> by default. Change it value to <b>true</b>.

3. NW IDE will generates 2 methods for this calculated attribute: <b>get<NodeName>RatingAttrCalc</b> and <b>set<NodeName>RatingAttrCalc</b>.

4. Switch to source of controller, and type the following:

get<NodeName>RatingAttrCalc:

return element.getRatingAttr();

set<NodeName>RatingAttrCalc:

element.setRatingAttr(value);

5. Re-bind UI controls from RatingAttr to RatingAttrCalc.

6. Test that everything works as before.

7. Now you have interceptor for assignment of values to RatingAttr from UI: whenever user enter some value in InputField or select value using EVS method <b>set<NodeName>RatingAttrCalc</b> is invoked. So you may add some pre/post processing before assigning value.

I hope pre/post- processing is what you were asking for and I understand you right

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Hi Valery,

What you are telling is OK. But I have explained you that I am making the complete attributes dynamically. So how can I make this new <b>RatingAttrCalc</b>, attribute in the context as I am coding to create a attribute instead of physically creating it under the Context node.

Can I create this calculated node dynamically?? If yes then how!! I have looked to the avavilable function for a attribute created, the only function which is provided for calculated attribute is "<b>setCalculatedAttributeAccessor</b>", I really dont know whether this could help me or not.

I hope you are getting me!!

Regards

Former Member
0 Kudos

SDN,

<b>setCalculatedAttributeAccessor</b> is exactly what you need!

Use this as example:


final IWDNodeInfo nodeInfo = <...>;
final IWDAttributeInfo ratingAttrInfo = <...>;
		
final IWDCalculatedAttributeAccessor accessor = new IWDCalculatedAttributeAccessor()
{
  public Object get(final IWDNodeElement el, final IWDAttributeInfo attr)
  {
    return el.getAttributeValue("RatingAttr");
  }
			
  public void set(final IWDNodeElement el, final IWDAttributeInfo attr, final Object value)
  {
    /* pre-processing may be placed here */
    el.setAttributeValue("RatingAttr", value);
    /* post-processing may be placed here */
  }
};

final IWDAttributeInfo ratingAttrCalcInfo =
  nodeInfo.addAttribute( "RatingAttrCalc", ratingAttrInfo.getDataType() );
ratingAttrCalcInfo.setCalculatedAttributeAccessor( accessor );

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

Valery,

This is OK!! I have customized the code snippet you have given according to my code. But the purpose is still not solved. Where are the Getter and Setter Classes.. And how dop I capture the event in through this Calculated Attribute.

Dear! If you require I can send you my code so that you have a better understanding. If I need to do so then kindly let me know your eMail-ID.

I hope I am making some sence!

Regards

Former Member
0 Kudos

SDN,

Check my code again, there is a comments where you can place your logic:


final IWDCalculatedAttributeAccessor accessor = new IWDCalculatedAttributeAccessor()
{
  public Object get(final IWDNodeElement el, final IWDAttributeInfo attr)
  {
    return el.getAttributeValue("RatingAttr");
  }
			
  public void set(final IWDNodeElement el, final IWDAttributeInfo attr, final Object value)
  {
    <b>/* I MEAN HERE SHOULD BE YOUR CODING */</b>   
    /* pre-processing may be placed here */
    el.setAttributeValue("RatingAttr", value);
    /* post-processing may be placed here */
  }
};

Anyway, you may send me your code to vsilaev AT gmail DOT com

Btw, when intercepting value assignment, what exactly you have to do?

VS

Former Member
0 Kudos

Hi Valery,

I wish there could be more 6 Points.. I wanted to reward you that :)..Anyways regrading the problem..

Actually I want to call a save function in the backend BO (Business Object), as soon as user selects some value in the cell of this table. There are specific reasons for this approach (of saving value, as soon as it is selected from OVS), but please dont ask me to explainit to you as I had a long head breaking discussion regarding the same with my Collegues :(.. They are insisting to do this, but I am in a favour of getting all the values in the table through value selection and finally do the <b>Mass Save</b>!!

Anyways, I am sending you the code at ur ID please have a look and let me know what should I do..

Regards

Former Member
0 Kudos

Hi Valery,

I have already mailed you!! Kindly have a look to it. I am waiting for your reply

Regards

Former Member
0 Kudos

SDN,

I've got it.

However it will take certain time to grasp what are you trying to do -- there are several kilos of code

Btw, that's why WD tutorials recommend to split code between controllers rather then place everything in single controller -- it would be much easier to read it and maintain.

VS

Former Member
0 Kudos

Hi Valery,

Yes dear!! You are right.. I will keep this in mind, in my future developments.

Thanks for the valuable tip!! But I am very new to webdynpro thats why didn't know how to use all these effectively and where to apply these controllers. i know the concept but dont know when to apply

For eg: In the current can you spot out the places where I should have used the controller.

Frankly speaking I was planning to do exactly what you were saying as the rendering time for the view is very large I am doing all manipulation of code in the view contrller itself. By doing so I think I can greatly reduce the rendering time. Am I correct??

So kindly tell me how to figure out the places where we ahould apply these controllers.

By the way thanks for all your effort you are doing for me

Regards

Former Member
0 Kudos

Hi Valery,

I am still waiting for the reply!! Have you gone through the code I have send to you. Kindly suggest me the solution.

I am really stuck up at this stage, If I could not do this, probably I cant proceed further.

Regards

Former Member
0 Kudos

SDN,

From what I can see (method createTable) you are creating only 2 columns, but according to image you have to create 5 or 4 (not sure for ApprovalStatus).

Here I will just put a sample how to report changed value for operator column, the rest is the same. I don't know how you'll save this value, but simply replace call to message manager call with call to your "save" function:


if (isResult.equalsIgnoreCase("true") )
{
 ...
}
else
{
 final IWDAttributeInfo attrInfo = (IWDAttributeInfo)itrElement.next();

 /* it is better to place these 2 lines out of while loop */
 final IWDNodeInfo nodeTemp  = wdContext.nodeTemp().getNodeInfo();
 final IDataType attrOperatorType = nodeTemp.getAttribute("Operator").getDataType();

 final String attrOperatorName  = attrInfo.getName() + "_OPERATOR";

 final IWDAttributeInfo attrOperatorOriginal = nodeTemp.addAttribute(attrOperatorName, attrOperatorType);
  
 final IWDCalculatedAttributeAccessor accessor = new IWDCalculatedAttributeAccessor()
 {
   public Object get(final IWDNodeElement el, final IWDAttributeInfo attr){
     return el.getAttributeValue(attrOperatorName);
   }
   public void set(final IWDNodeElement el, final IWDAttributeInfo attr, final Object value)  {
     /* pre-processing may be placed here */
     el.setAttributeValue(attrOperatorName, value);
     wdComponentAPI.getMessageManager().reportSuccess
     (
       "Saving operator value ""+ value + "" changed for info "" + 
       attrInfo.getName() + "", row index " + element.index();
     );
     /* post-processing may be placed here */
   }
 };

 final IWDAttributeInfo attrOperatorCalc = nodeTemp.addAttribute(attrOperatorName + "_CALC", attrOperatorType);
 attrOperatorCalc.setCalculatedAttributeAccessor(accessor);


 final IWDTableColumn   colOperator = (IWDTableColumn)view.createElement(IWDTableColumn.class, null);

 final IWDInputField    edtOperator = (IWDInputField)view.createElement(IWDInputField.class, null);
 edtOperator.bindValue( attrOperatorCalc );

 final IWDCaption hdrOperator = (IWDCaption) view.createElement(IWDCaption.class,null);
 hdrOperator.setText("Operator");

 colOperator.setTableCellEditor(edtOperator);
 colOperator.setHeader(hdrOperator);

 final IWDTableColumn colFinal = (IWDTableColumn) view.createElement(IWDTableColumn.class,null);

 final IWDInputField edtFinal  = (IWDInputField)view.createElement(IWDInputField.class,null);
 edtFinal.bindValue( attrInfo );

 final IWDCaption hdrFinal = (IWDCaption) view.createElement(IWDCaption.class,null);
 hdrFinal.setText( attrInfo.getName() );

 colFinal.setTableCellEditor(idk);
 colFinal.setHeader(hdrFinal);

 iTabFinal.addGroupedColumn(colOperator);
 iTabFinal.addGroupedColumn(colFinal);
}

However, I'm not sure about TempNode / NewElementsNode relation. If you bind table to NewElements then you have to create attributes in NewElements node or in non-singleton subnode thereof.

VS

Former Member
0 Kudos

Hi Valery,

Although, I know I have to come back toy you again regarding the same problem, but still for the time being let me work on this particular problem.

Anyways I am getting the desired result for the operator column. No no !! I think you must have mis read the code. All the columns are made there itself in the code. But the only thing is it is dynamic in the loop.

I am making 3 columns from values I am getting from backend and 2 are the Operator that I am getting from dictionary.

Anyways thanks for the result for the time being

Regards

Answers (0)