Forum Stats

  • 3,815,978 Users
  • 2,259,122 Discussions
  • 7,893,350 Comments

Discussions

Interactive Grid - Column - Not Updatable by User - But updatable through DA

user11993880
user11993880 Member Posts: 34 Blue Ribbon

We are in Application Express 20.2.0.00.20.

I have two regions.

Example: Dept (Master)

         Emp (Detail)

Whenever the user clicks on the Department region record, detailed employee region Interactive Grid data will get a refresh.


I have the following requirement on detail region.

1) Commission column is not updatable/enterable by the user.

2) Commission column is calculated based on the department selected on each record of the employee.

3) I should be able to save this entire record.


When I disable the commission column, the value is not getting saved into the database.


I tried using multiple Dynamic Action events to enable and disable the Commission field, but still, time the value of the Commission not getting saved into the database.


I have seen a couple of posts on making display field and Hidden field combinations and it doesn't seem to be working in this version.


Please share.

Tagged:

Answers

  • user11993880
    user11993880 Member Posts: 34 Blue Ribbon

    Please share your ideas.

  • Tu Nguyen
    Tu Nguyen Member Posts: 117 Bronze Badge

    Use Process, not DA.

  • user11993880
    user11993880 Member Posts: 34 Blue Ribbon

    Thanks for your response.

    If I understand correctly, process is to update the data into the database. But, in this case I have to display commission value to the user. Once user satisfies the data calculated on the commission column, he will press the save button.

    Mudhaffer Al-Jabery
  • Rick-Pick
    Rick-Pick Member Posts: 95 Bronze Badge

    Part of the problem may be the way you "disabled" the column. There are several ways to stop the user entering data in a field and/or saving it to the database: disable it with a DA (as you seem to have done), make it read only declaratively using the Read Only column setting or with CSS (e.g. built in "is-readonly" class), turn the Query Only switch on - which will stop it being saved - etc.

    The key thing is that in the IG a change must be made in a record for it to be included in the update. If the user doesn't make any change, but you want the record to be saved, you will have to include a hidden field which you populate using code. In your case, since you say the user has to be satisfied with the calculated commission, do you have a field which the user updates to indicate this?

    One way I use to accomplish what I think you're aiming at is to create a calculated field in the IG, using an SQL Expression as the column Source. By definition the field is not updateable by the user and your SQL expression can reference any columns in the current record and any page items. Have the user make some change to the record by selecting the department or indicating acceptance of the commission. You will need to write your own PL/SQL process to save the grid and use :APEX$ROW_STATUS to distinguish updates, creates and deletions (if you allow them all).

    Alternatively the commission field can be a database column made read only using CSS. For example you could write a DA on change of department that would calculate the commission. Use a Remove Class action to allow the commission field to be changed, populate it, then use an Add Class action to make it read only again.