Sign Up

Hey, Dev!
Are you looking for a forum full of active developers to help you?
So if you want to:
➡️ Get answers for your development issues
➡️ Help others
➡️ Write an article
➡️ Get rewarded for your active participation
Then this place is just for you and it is 100% FREE.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

OrclQA.Com

OrclQA.Com Logo OrclQA.Com Logo
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Blog
  • New Questions
  • Tutorials
    • Oracle
    • Oracle Apex
    • Python
  • Tags
  • Users
  • Badges & Points
  • About
Home/Questions/Q 4657
Answered
SM Hasem
SM Hasem

SM Hasem

  • Dhaka, Bangladesh
  • 4 Questions
  • 15 Answers
  • 0 Best Answers
  • 42 Points
View Profile
  • 0
SM HasemContributor
Asked: January 23, 20212021-01-23T14:29:36+05:30 2021-01-23T14:29:36+05:30

How to add one column data to another column in same row in Interactive Grid on oracle apex?

  • 0

How to add one column data to another column in same row in Interactive Grid on oracle apex?

How to add one column data to another column in same row in Interactive Grid on oracle apex?

question
  • 17
  • 216
  • 1
  • 0
  • Share
    • Share on Facebook
    • Share on Twitter
Answer

    17 Answers

    1. pavlos

      pavlos

      • 21 Questions
      • 71 Answers
      • 0 Best Answers
      • 205 Points
      View Profile
      pavlos Professional
      2021-01-23T15:29:40+05:30Added an answer on January 23, 2021 at 3:29 pm

      Hi!

      You can use pipes:

      SELECT ename||' - '||sal as "Ename and Sal"
      FROM emp;
      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • SM Hasem

        SM Hasem

        • Dhaka, Bangladesh
        • 4 Questions
        • 15 Answers
        • 0 Best Answers
        • 42 Points
        View Profile
        SM Hasem Contributor
        2021-01-23T16:48:30+05:30Replied to answer on January 23, 2021 at 4:48 pm

        I dont understand about your ans.  In IG column have data from a table. I want to know that, same data add to other column. same as. Sal = 20000, update_sal = 20000.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
      • SM Hasem

        SM Hasem

        • Dhaka, Bangladesh
        • 4 Questions
        • 15 Answers
        • 0 Best Answers
        • 42 Points
        View Profile
        SM Hasem Contributor
        2021-01-23T16:49:45+05:30Replied to answer on January 23, 2021 at 4:49 pm

        Thank you so much for your instant reply.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • Vinish

          Vinish

          • 1 Question
          • 470 Answers
          • 45 Best Answers
          • 2k Points
          View Profile
          Vinish Legendary
          2021-01-23T18:02:08+05:30Replied to answer on January 23, 2021 at 6:02 pm

          On what event do you want to copy the value from that column to another? On page load? Or when the user changes the value in the Service Charge column?

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
          • SM Hasem

            SM Hasem

            • Dhaka, Bangladesh
            • 4 Questions
            • 15 Answers
            • 0 Best Answers
            • 42 Points
            View Profile
            SM Hasem Contributor
            2021-01-23T20:13:29+05:30Replied to answer on January 23, 2021 at 8:13 pm

            This page have one Item, when this item change set have an  action for below region refresh. after refresh need to this action sir.

            • 0
            • Share
              Share
              • Share on Facebook
              • Share on Twitter
            • SM Hasem

              SM Hasem

              • Dhaka, Bangladesh
              • 4 Questions
              • 15 Answers
              • 0 Best Answers
              • 42 Points
              View Profile
              SM Hasem Contributor
              2021-01-23T20:20:01+05:30Replied to answer on January 23, 2021 at 8:20 pm

              This page have one Item, when this item change set have an  action for below region refresh. after refresh need to this action sir.

              • 0
              • Share
                Share
                • Share on Facebook
                • Share on Twitter
    2. SM Hasem

      SM Hasem

      • Dhaka, Bangladesh
      • 4 Questions
      • 15 Answers
      • 0 Best Answers
      • 42 Points
      View Profile
      SM Hasem Contributor
      2021-01-23T20:22:49+05:30Added an answer on January 23, 2021 at 8:22 pm

      Service charge data return to Collection Amount Column when change lOV -Bill Month.

      Bill Month is item have refresh dynamic action.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Vinish

        Vinish

        • 1 Question
        • 470 Answers
        • 45 Best Answers
        • 2k Points
        View Profile
        Vinish Legendary
        2021-01-24T07:19:47+05:30Replied to answer on January 24, 2021 at 7:19 am

        Then create one more dynamic action (Execute PL/SQL code) on bill month LOV (before Refresh DA) to update the table the grid based on. Below is an example:

        Update yourGridTable
           set collection_amount = service_charge
        where yourGridcondition;

        Then after the refresh, it will show the collection amount.

        • 1
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
        • SM Hasem

          SM Hasem

          • Dhaka, Bangladesh
          • 4 Questions
          • 15 Answers
          • 0 Best Answers
          • 42 Points
          View Profile
          SM Hasem Contributor
          2021-01-24T08:57:43+05:30Replied to answer on January 24, 2021 at 8:57 am

          Sorry Sir, I couldn't explain it to you.

          Sir, I want to data transfer only form without update table. Its possible for this quary?

          Sir, this data transfer service_charge column to collection_amount column then  if need data modification,  will done then insert into table.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
        • SM Hasem

          SM Hasem

          • Dhaka, Bangladesh
          • 4 Questions
          • 15 Answers
          • 0 Best Answers
          • 42 Points
          View Profile
          SM Hasem Contributor
          2021-01-25T09:22:40+05:30Replied to answer on January 25, 2021 at 9:22 am

          Thank you so much sir.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
    3. Vinish

      Vinish

      • 1 Question
      • 470 Answers
      • 45 Best Answers
      • 2k Points
      View Profile
      Vinish Legendary
      2021-01-25T06:17:10+05:30Added an answer on January 25, 2021 at 6:17 am

      Ok, then create a dynamic action on the bill month item to execute JavaScript code. Also, specify a static id to your grid, for example, "igbill". Now add the below JavaScript code to it:

      var model = apex.region("igbill").widget().interactiveGrid("getViews", "grid").model;
      var n_service_charge, n_collection_amount;
      n_service_charge = model.getFieldKey("SERVICE_CHARGE");
      n_collection_amount = model.getFieldKey("COLLECTION_AMOUNT");
      model.forEach(function(igrow) {
      igrow[n_collection_amount] = igrow[n_service_charge];
      });

      When the user changes the billing month, it will loop through the interactive grid and assign the service charge to the collection amount.

      • 1
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • SM Hasem

        SM Hasem

        • Dhaka, Bangladesh
        • 4 Questions
        • 15 Answers
        • 0 Best Answers
        • 42 Points
        View Profile
        SM Hasem Contributor
        2021-01-26T22:23:38+05:30Replied to answer on January 26, 2021 at 10:23 pm

        Sir, data set after click every cell. not automatic set for all cell when change bill_month item.

        when set action:change in dynamic action on bill_month DA fired but return null.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
    4. goto150

      goto150

      • Wroclaw, Poland
      • 0 Questions
      • 18 Answers
      • 4 Best Answers
      • 149 Points
      View Profile
      goto150 Professional
      2021-01-27T17:07:09+05:30Added an answer on January 27, 2021 at 5:07 pm

      If I get your problem correctly you want to simply pass a value from one column to another in case initial value has changed.

      If that's the case let me use EMP table as an example. DEPENDANT ("virtual") column I added just for the purpose of this example. It would react on change of EMPNO column.

      This is source query for your interactive grid:

      SELECT E.*, NULL AS DEPENDANT FROM EMP E

      Here is explanation:

      1. expand columns of your interactive grid
      2. right click on EMPNO and choose create dynamic action
      3. WHEN section
        1. EVENT = Change
        2. Selection type = Column(s)
        3. Region = IG
        4. Column(s) = EMPNO
      4. True action is:
        1. Identification = Set Value
        2. Settings
          1. Set type = PL/SQL Expression
          2. PL/SQL Expression = :EMPNO
        3. Items to Submit  = EMPNO
        4. Affected Elements
          1. Selection Type = Column(s)
          2. Column(s) = DEPENDANT
        5. Execution Options
          1. Fire on Initialization = False (disable)

      With this in place whenever you change value of EMPNO and then navigate to different cell, DEPENDANT will be updated.

       

      • 2
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • SM Hasem

        SM Hasem

        • Dhaka, Bangladesh
        • 4 Questions
        • 15 Answers
        • 0 Best Answers
        • 42 Points
        View Profile
        SM Hasem Contributor
        2021-01-28T08:46:55+05:30Replied to answer on January 28, 2021 at 8:46 am

        My Grid Source are below:-

        select ROWID,
        CLIENTS_ID,
        TITLE,
        PROJECT_NAME,
        AREA,
        SERVICE_CHARGE,
        COLLECTION_AMOUNT,
        BILL_MONTH,
        SOFTWARE_STATUS,
        ENTRY_DATE,
        BILL_MONTH_2ND
        from COLLECTION_LIST
        where MONTH_WISE_DATE <= :P6_BILL_MONTH;

         

        When change  :P6_BILL_MONTH Item, I want SERVICE_CHARGE  data set into COLLECTION_AMOUNT. I will edit COLLECTION_AMOUNT  column then insert into my table. How can I do it?

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
    5. goto150

      goto150

      • Wroclaw, Poland
      • 0 Questions
      • 18 Answers
      • 4 Best Answers
      • 149 Points
      View Profile
      goto150 Professional
      2021-01-28T17:17:23+05:30Added an answer on January 28, 2021 at 5:17 pm

      Maybe you could simply solve this at the data source level. Assuming your :P6_BILL_MONTH is LOV accepting NULLs (Display Null Value = TRUE), then you could use NVL2 to display SERVICE_CHARGE in case :P6_BILL_MONTH is selected (meaning not null).

      
      SELECT ROWID
           , CLIENTS_ID
           , TITLE
           , PROJECT_NAME
           , AREA
           , SERVICE_CHARGE
           , NVL2(:P6_BILL_MONTH,SERVICE_CHARGE,COLLECTION_AMOUNT) AS COLLECTION_AMOUNT
           , BILL_MONTH
           , SOFTWARE_STATUS
           , ENTRY_DATE
           , BILL_MONTH_2ND
        FROM COLLECTION_LIST
       WHERE MONTH_WISE_DATE <= :P6_BILL_MONTH;
      
      I assume you created Refresh Region Dynamic Action triggered by :P6_BILL_MONTH change and you use this item in Page Items to Submit Source region definition.
      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • SM Hasem

        SM Hasem

        • Dhaka, Bangladesh
        • 4 Questions
        • 15 Answers
        • 0 Best Answers
        • 42 Points
        View Profile
        SM Hasem Contributor
        2021-01-28T20:08:59+05:30Replied to answer on January 28, 2021 at 8:08 pm

        When use this code, grid save button not working. How to use save or any button to save data grid to table?

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
    6. goto150

      goto150

      • Wroclaw, Poland
      • 0 Questions
      • 18 Answers
      • 4 Best Answers
      • 149 Points
      View Profile
      Best Answer
      goto150 Professional
      2021-01-29T15:11:39+05:30Added an answer on January 29, 2021 at 3:11 pm

      You're right. My bad, firstly this NVL2(:P5_BILL_...) column is virtual and secondly it does not leave cells in edit mode. I'd say lose-lose instead of win-win:)

      Lets try JavaScript. For the demo I am going to create a button to fire DA.

      1. Set Static ID for the region holding your interactive grid
        1. Region properties --> Advanced
          1. Static ID = SID_COLLECTION_LIST
      2. Right click on the Region --> Create Button
        1. Button Name = Forecast
        2. Label = Forecast
        3. Button Position = Top of Region (to easily locate it)
      3. In Dynamic Actions tab right click on Events --> Create Dynamic Action
        1. Identification
          1. Name = Fill collection amount
        2. When
          1. Event = Click
          2. Selection Type = Button
          3. Button = Forecast
      4. True (action)
        1. Identification
          1. Action = Execute JavaScript Code
        2. Settings
          1. Code:
      var model   = apex.region("SID_COLLECTION_LIST").widget().interactiveGrid("getViews","grid").model;
      model.forEach(function( record ) {
      model.setValue( record, "COLLECTION_AMOUNT",model.getValue( record, "SERVICE_CHARGE" ));
      }
      );

      I hope this would help you, and the reason I did not add this to Change event of the LOV is that I would not know how to easily chain Refresh() --> DA (Fill collection amount). If you put both: Refresh and DA under :P6_BILL_MONTH Change() event, both will fire synchronously and you won't get your collection column refreshed.

      • 2
      • Share
        Share
        • Share on Facebook
        • Share on Twitter

    You must login to add an answer.

    Forgot Password?

    Sidebar

    Ask Question
    Write a Post
    • Recent
    • Answers
    • GudDud

      Load PDF into APEX, Edit it and Print it.

      • 0 Answers
    • AnuK

      Error: Ajax call returned server error ORA-00932: inconsistent datatypes: expected ...

      • 0 Answers
    • pavlos

      How to reduce space between two Display Image items?

      • 1 Answer
    • Bheem

      Scrollable News with thumbnail

      • 0 Answers
    • Vinish
      Vinish added an answer You can reduce the number of column span for the… March 4, 2021 at 7:53 am
    • Abdulkareem
      Abdulkareem added an answer Below query is working fine SELECT city,name FROM JSON_TABLE ('[{"city":"Stockholm","name":"Lennart… March 3, 2021 at 6:16 pm
    • Vinish
      Vinish added an answer Below is the correct query: SELECT city, name FROM JSON_TABLE… March 3, 2021 at 9:18 am
    • Bheem
      Bheem added an answer Got the answer. Thank you March 3, 2021 at 9:07 am
    • afzal
      afzal added an answer STEP -1 CREATE REPORT LIKE-- select SAL AS "SALARY", NVL(COMM,0)… March 2, 2021 at 10:25 am

    Recent Blog Posts

    • Vinish

      Oracle Apex - Display External File in Region

    • Vinish

      Oracle PL/SQL Download BLOB File to Disk

    • Vinish

      Oracle Convert External File to BLOB

    • Vinish

      Oracle Apex Calendar Example

    • Vinish

      Oracle Apex - Open Modal Dialog Page Using JavaScript

    Explore

    • Home
    • Blog
    • New Questions
    • Tutorials
      • Oracle
      • Oracle Apex
      • Python
    • Tags
    • Users
    • Badges & Points
    • About

    © 2021 OrclQA.Com. All Rights Reserved. Privacy Policy