Thursday, January 17, 2013

Default value to view attribute using other attribute of same row

Default value to view attribute using other attribute of same row

Some time requirement will come in development to set some view-obejct attribute based on other attribute. This post will guide you how to achieve this functionality without even using the groovy expression.

Here in this post I am using ViewRowImpl to achieve this requirement.

I defined ViewRowImpl as shown below
  
By checking include accessors means setter/getter for each attribute is generated in ViewRowImpl class.

 Here we have 3 column SUID, ID and Name on save i want to copy id data to SUID fields.

    public void setId(Number value) {
        setAttributeInternal(ID, value);
        setAttributeInternal(SUID, value);
    }
 above code successfully set ID column data to SUID. 

find the sample application with source and table script Application

26 comments:

  1. There are two methods
    1) public void setSuid(Number value) {
    setAttributeInternal(SUID, value);
    }

    2) public void setId(Number value) {
    setAttributeInternal(ID, value);
    setAttributeInternal(SUID, value);
    }
    Is second method overriding the value of SUID that is set by first method? and I think we should also use the same method execution sequence....

    ReplyDelete
    Replies
    1. This is because requirement was to override the SUID by ID.

      Delete
  2. You can do the same decoratively as well. At the default expression of suid set the expression like #{object.id} and in the control hints of suid add the dependent on id filed.

    ReplyDelete
  3. it is work on Application module run, but when i run it on fragments, an error appear "suid is required" although the value is appear in the attribute?

    ReplyDelete
  4. I appreciate you sharing this article. Really thank you! Much obliged.
    This is one awesome blog article. Much thanks again.


    sap online training
    software online training
    sap sd online training
    hadoop online training
    sap-crm-online-training

    ReplyDelete
  5. Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!

    oracle online training
    sap fico online training
    dotnet online training
    qa-qtp-software-testing-training-tutorial

    ReplyDelete
  6. Hi Amit,

    Hope you would help me out in resolving the below requirement about how to do it in oracle OAF:

    I had a employee table with name, salary, %increase, total salary and the table has only employee and salary information, this i have to show in a editable table format which i am able to show:

    Here are the requirements:

    1. when the user enters %increase the total should automatically calculate like (salary + (salary*%increase/100))

    employee salary [%increase] total salary
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    2. when the user enters total salary then %increase should automatically calculate

    employee salary %increase [total salary]
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    3. when the user clicks [Add2%] button then %increase for all the rows should show as 2 and also the total salary column should automatically calculate as per the %increase and salary

    employee salary [%increase] [total salary]
    =======================================
    abc 1000 2 1020
    xyz 2000 2 2040

    [Add2%] button clicked

    Hope you would help me, how to handle these requirements.

    Thanks in advance,
    Rhea

    ReplyDelete
  7. Hi Amit,

    Hope you would help me out in resolving the below requirement about how to do it in oracle OAF:

    I had a employee table with name, salary, %increase, total salary and the table has only employee and salary information, this i have to show in a editable table format which i am able to show:

    Here are the requirements:

    1. when the user enters %increase the total should automatically calculate like (salary + (salary*%increase/100))

    employee salary [%increase] total salary
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    2. when the user enters total salary then %increase should automatically calculate

    employee salary %increase [total salary]
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    3. when the user clicks [Add2%] button then %increase for all the rows should show as 2 and also the total salary column should automatically calculate as per the %increase and salary

    employee salary [%increase] [total salary]
    =======================================
    abc 1000 2 1020
    xyz 2000 2 2040

    [Add2%] button clicked

    Hope you would help me, how to handle these requirements.

    Thanks in advance,
    Rhea

    ReplyDelete
  8. Hi Amit,

    Hope you would help me out in resolving the below requirement about how to do it in oracle OAF:

    I had a employee table with name, salary, %increase, total salary and the table has only employee and salary information, this i have to show in a editable table format which i am able to show:

    Here are the requirements:

    1. when the user enters %increase the total should automatically calculate like (salary + (salary*%increase/100))

    employee salary [%increase] total salary
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    2. when the user enters total salary then %increase should automatically calculate

    employee salary %increase [total salary]
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    3. when the user clicks [Add2%] button then %increase for all the rows should show as 2 and also the total salary column should automatically calculate as per the %increase and salary

    employee salary [%increase] [total salary]
    =======================================
    abc 1000 2 1020
    xyz 2000 2 2040

    [Add2%] button clicked

    Hope you would help me, how to handle these requirements.

    Thanks in advance,
    Rhea

    ReplyDelete
  9. Hi Amit,

    Hope you would help me out in resolving the below requirement about how to do it in oracle OAF:

    I had a employee table with name, salary, %increase, total salary and the table has only employee and salary information, this i have to show in a editable table format which i am able to show:

    Here are the requirements:

    1. when the user enters %increase the total should automatically calculate like (salary + (salary*%increase/100))

    employee salary [%increase] total salary
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    2. when the user enters total salary then %increase should automatically calculate

    employee salary %increase [total salary]
    ======================================
    abc 1000 2 1020
    xyz 2000 3 2060

    3. when the user clicks [Add2%] button then %increase for all the rows should show as 2 and also the total salary column should automatically calculate as per the %increase and salary

    employee salary [%increase] [total salary]
    =======================================
    abc 1000 2 1020
    xyz 2000 2 2040

    [Add2%] button clicked

    Hope you would help me, how to handle these requirements.

    Thanks in advance,
    Rhea

    ReplyDelete
  10. I was recommended this web site by means of my cousin.
    I am now not certain whether this post is written through him as nobody else recognise such precise about my difficulty. You're amazing! Thank you!


    selenium training in Tambaram

    selenium training in Velachery

    selenium training in Omr

    selenium training in Annanagar

    selenium training in Chennai

    ReplyDelete

Thanks for your valuable comment. You comment will go live soon.