cancel
Showing results for 
Search instead for 
Did you mean: 

Counter Button in a table

Former Member
0 Kudos

Hello@all,

I have a table with a lot of rows.

in two column I have set buttons for counting.

The table looks like the following:

Activity->ServiceType->Count->Period->Count_Down--->Count_Up

Install->InScope->10->perYear->"DownButton"--->"UpButton"

Copy->OutOfScope->' '->' '->"DownButton"--->"UpButton"

Backup->InScope->5->perMonth->"DownButton"--->"UpButton"

Now when I push the "DownButton" I want to count down the value of the column Count for exactly the row in which the button is set.

How should I do this.

And for the "UpButton" I want to count up.

For example: I have the possibility to "Backup" a system 5 times per month. when I did this job for one time, I want to push the UpButton in the row for Backup and then the Count should change to 6.

Please help me

Best regards

Marcus

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello.

You would need to use parameter mapping (described here: http://help.sap.com/saphelp_erp2005/helpdata/en/60/1f1f056f057d4d962375efd3c92ed0/content.htm).

In short you obtain reference to your button in wdDoModifyView (only possible place), and add a parameter with button.mappingOfOnAction().addParameter.

Add the parameter as parameter to the action connected to the button.

Regards, Mikael

Former Member
0 Kudos

Hi,

If you are using CE use the parameter mapping and map the nodeElement to an attribute of either generic type (IWDNodeElement) or i<your Elememt> type.

in older versions you have to do this mapping part in the wdDomodify using code

IWDButton button = (IWDButton) view.getElement("<BUtton>");

button.mappingOfOnAction().addSourceMapping("nodeElement", "nodeElement");

Create a parameter of type mentioned above for your action

based on the type of the parameter you can either use generic or explicit methods to access the params

Regards

Ayyapparaj

Former Member
0 Kudos

Can you explain me this exactly.

What should I do where?

Where should I write which code?

Thank you

Best regards

Marcus

Former Member
0 Kudos

Create an action "ChangeValue". Add two parameters

- "row" of type I<Node>Element where <Node> is the data source node of the table.

- "delta" of type "integer"

Create an event parameter mapping ("nodeElement" -> "row") for the buttons used as table cell editor. If your IDE supports it, you can use the parameter mapping editor (Outline, right-click on cell editor button, select "Parameter mapping"). If not, search the forum for the code, I have posted this a thousand times.

For the button that should increment the value by +1, add a parameter mapping ("delta" -> "1"), for the other one use ("delta" -> "-1").

In the action handler, write


void wdOnActionChangeValue(..., I<Node>Element row, int delta)
{
  row.set<Attribute>(row.get<Attribute>() + delta);
}

Here, <Attribute> denotes the context attribute storing the value to be incremented.

Armin