Skip to Content
avatar image
Former Member

how to make new column in table changing depending on other columns

hi

i have table and i want to add new column that calculate the deference between two other columns.

i create the column and i could loop in the content of the table but i could not update the entries in the new columns.

regards

Said

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 14, 2007 at 05:03 AM

    Hai,

    Create a table with coloumns bind the datanode--Data(a,b,diff attributes).

    ArrayList al =new ArrayList();
    for(int i=0;i<wdContext.nodeData().size();i++){
    IprivateXXView.IdataElement ele=wdContext.createDataElement();
    ele.setA(wdContext.nodeData().getDataElement(i).getA());
    ele.setB(wdContext.nodeData().getDataElement(i).getB());
    ele.setDiff(wdContext.nodeData().getDataElement(i).getB()-wdContext.nodeData().getDataElement(i).getA());
    al.add(ele);
    }
    wdContext.nodeData().bind(al);

    Regards,

    Naga

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 14, 2007 at 05:49 AM

    Hi!

    did u try creating a node for the same? create a value node for the table with 3 value attrbutes, one for each column. then in the init method of that view, just create 3 arrays, setting the value in the first two array. then make use of this code for setting the difference in the thrid column

    IPrivateUIView.I<valuenode> tab_node = wdContext.node<valuenode>();

    for(int i= 0; i<6;i++)

    {

    IPrivate<view>.I<valueelement> num_ele = tab_node.create<valueelement>();

    num_ele.set<valueattribute1>(num1<i>);

    num_ele.set<valueattribute2>(num2<i>);

    num_ele.set<diffvalueattribute>(num1<i>-num2<i>);

    wdContext.node<valuenode>().addElement(num_ele);

    }

    this will surely work .

    Do let me know the results.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 16, 2007 at 11:31 AM

    Hai Mohammed,

    You just create a table with coloumns a,b and c(a-b).In the component controller context for 'c' you set the property calculated as true,then you will get two methods getter and setter.In the getter method you just return the difference like this.

    public int getdiff()

    {

    return(obj.getA()-obj.getB());

    }

    you will get the result.

    Regards

    Sathish

    Add comment
    10|10000 characters needed characters exceeded