Skip to Content
avatar image
Former Member

Dispaly unique value in table column

i am having a webdynpro table having the values like the fallowing.

Qdesc Ans

======= ======

1 good

2 fine

2 excellent

3 value

but i want to display the fallowing way

Qdesc Ans

======= ======

1 good

2 fine

excellent

3 value

Please

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Apr 13, 2011 at 03:03 AM

    Hi,

    Just a bit of coding should do it:

    - Populate your Table Data (which should be in a Context Node)

    - Create a List to hold the values;

    - Iterate in your Table Data Node;

    - Do a List.contains(value); either add the value to your list and move to the next record or "blank out" the Context Attribute you want;

    You are looking for something like:

    List uniqueCodes = new ArrayList();
    int i = nodeSize;
    for (i) {
      element = node.getElement(i)
      code = element.getCode()
      if (uniqueCodes.contains(code)) {
        element.setCode(""); // or null, check what you really need..
      }
      else {
        uniqueCodes.add(code);
      }
    }
    

    This should do what you want considering:

    - Table is ordered when you Iterate;

    - You want to keep only the first row that appears in the Table;

    Hope it helps,

    Daniel

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2011 at 06:02 AM

    IWDTableColumn has a property named "groupingValue" which provides this functionality.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 13, 2011 at 07:15 AM

    Hi Thota Ravi,

    I prefer to do it by table column property called grouping values rather then coding it own. Which have some performance improvement and less error prone.

    Regards

    Jeetendra

    Add comment
    10|10000 characters needed characters exceeded