Sign Up

❇️ OrclQA.Com is a question and answer forum for programmers.
❇️ Here anyone can ask questions and anyone can answer to help others.
❇️ It hardly takes a minute to sign up 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
Sign InSign Up

OrclQA.Com

OrclQA.Com Logo OrclQA.Com Logo

OrclQA.Com Navigation

  • Oracle
  • Oracle Apex
  • Python
  • Questions
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Ask Question
  • Add Post
  • Oracle
  • Oracle Apex
  • Python
  • Questions
Huy Nguyen
Huy Nguyen

Huy Nguyen

  • 6 Questions
  • 17 Answers
  • 0 Best Answers
  • 67 Points
View Profile
  • 1
Huy NguyenProfessional
Asked: March 5, 20212021-03-05T08:29:49+05:30 2021-03-05T08:29:49+05:30

Dynamic action on column on Interactive Grid

  • 1

Hi everyone,

I have one case about dynamic action.

Now I have two column named A and B.  Column, A is display only which I create dynamic action on A (I don't know how to choose action suitable for my action) to change B.

My actions is when A is not null then B = 1 else B= 0;

Thank you for your time and in advance.

question
  • 11
  • 1k
  • 0
  • 0
  • Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
Answer

11 Answers

  1. Vinish Kapoor

    Vinish Kapoor

    • 1 Question
    • 727 Answers
    • 63 Best Answers
    • 4k Points
    View Profile
    Best Answer
    Vinish Kapoor Enlightened
    2021-03-05T11:14:42+05:30Added an answer on March 5, 2021 at 11:14 am

    I think you do not need to create the dynamic action on the A column as it is display-only. You can manage it by specifying the default value for column B. Below are the steps:

    For column B, select Default value as SQL query and specify the following SQL query:

    select decode(:A, null, 0, 1) from dual;

    Now when the interactive grid loads, the B column will have the value accordingly.

    • 1
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
    • Vinish Kapoor

      Vinish Kapoor

      • 1 Question
      • 727 Answers
      • 63 Best Answers
      • 4k Points
      View Profile
      Vinish Kapoor Enlightened
      2021-03-05T11:22:57+05:30Replied to answer on March 5, 2021 at 11:22 am

      Oh, this will work for only new rows. For existing rows, you can change the IG source to SQL query and then use this expression in that query.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Huy Nguyen

        Huy Nguyen

        • 6 Questions
        • 17 Answers
        • 0 Best Answers
        • 67 Points
        View Profile
        Huy Nguyen Professional
        2021-03-05T12:09:34+05:30Replied to answer on March 5, 2021 at 12:09 pm

        Thank you for your good idea.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
      • Huy Nguyen

        Huy Nguyen

        • 6 Questions
        • 17 Answers
        • 0 Best Answers
        • 67 Points
        View Profile
        Huy Nguyen Professional
        2021-03-10T08:14:25+05:30Replied to answer on March 10, 2021 at 8:14 am

        Hi Vinish, I use default for that column B by select query:

        <

        select case when :B is not null then 0
        else 1
        end

        from dual; />

        But when I create a new row, with :B null or not null, it still have value equal 1. Thank you.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
  2. Vinish Kapoor

    Vinish Kapoor

    • 1 Question
    • 727 Answers
    • 63 Best Answers
    • 4k Points
    View Profile
    Vinish Kapoor Enlightened
    2021-03-10T08:24:59+05:30Added an answer on March 10, 2021 at 8:24 am

    As you mentioned, that your A column is read-only so it means on creating a new record the B column value should be 0 because column A will be null.

    To do this, create a dynamic action on your IG and select the event Row Initialization [IG]  and create a True action as following:

    • Action Type: Set Value
    • Set Type: Static Assignment
    • Value: 0
    • Selection Type: Columns
    • Column: B

    This should do the job. Please let me know if still any issues.

    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
  3. Huy Nguyen

    Huy Nguyen

    • 6 Questions
    • 17 Answers
    • 0 Best Answers
    • 67 Points
    View Profile
    Huy Nguyen Professional
    2021-03-10T08:35:18+05:30Added an answer on March 10, 2021 at 8:35 am

    Thank for your time. But it is my fault. Column A is display only, but it is column from I select from another table). It has value or not, belongs to another table. So, when A is not null B then 0 else 1. Sorry for my description, it is not clear.

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

      Vinish Kapoor

      • 1 Question
      • 727 Answers
      • 63 Best Answers
      • 4k Points
      View Profile
      Vinish Kapoor Enlightened
      2021-03-10T08:43:05+05:30Replied to answer on March 10, 2021 at 8:43 am

      Ok no problem. You can change the set value dynamic action as follows.

      Create a dynamic action on your IG on event Row Initialization and create a True action as below:

      • Action: Set Value
      • Set Type: PL/SQL Expression
      • PL/SQL Expression: case when :A is not null then 0 else 1 end
      • Item to Submit: A
      • Selection Type: Columns
      • Column: B

      Try it and let me know.

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
      • Huy Nguyen

        Huy Nguyen

        • 6 Questions
        • 17 Answers
        • 0 Best Answers
        • 67 Points
        View Profile
        Huy Nguyen Professional
        2021-03-10T08:51:58+05:30Replied to answer on March 10, 2021 at 8:51 am
        This answer was edited.

        I try this, but column B still has value of 1. But I forgot to remove default select query of B. When I remove default, column B has no value or null.

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

          Vinish Kapoor

          • 1 Question
          • 727 Answers
          • 63 Best Answers
          • 4k Points
          View Profile
          Vinish Kapoor Enlightened
          2021-03-10T09:41:13+05:30Replied to answer on March 10, 2021 at 9:41 am

          Because you are referring to another table for column A, then you should use Set Value type as SQL query and use the same condition you used for the IG and return a value for column B.

          • 0
          • Share
            Share
            • Share on Facebook
            • Share on Twitter
          • Huy Nguyen

            Huy Nguyen

            • 6 Questions
            • 17 Answers
            • 0 Best Answers
            • 67 Points
            View Profile
            Huy Nguyen Professional
            2021-03-11T09:03:34+05:30Replied to answer on March 11, 2021 at 9:03 am

            Yeah, I have a got idea with you. But When I try, it does not return value. It my Sql statement for true action of Set value for event change column C

            select case when lead_id is not null then 0
            else 1
            end from (
            select u.lead_id
            from dierp.users_lead u
            where u.id = :C);

            Item submit is C, column affect is B. You have a better idea about that? Maybe, I try create a trigger when after insert that table.

            • 0
            • Share
              Share
              • Share on Facebook
              • Share on Twitter
  4. Huy Nguyen

    Huy Nguyen

    • 6 Questions
    • 17 Answers
    • 0 Best Answers
    • 67 Points
    View Profile
    Huy Nguyen Professional
    2021-03-11T19:47:28+05:30Added an answer on March 11, 2021 at 7:47 pm

    I find out a way to solve that problem by creation trigger for that table. Thank you every one, especially Vinish Kapoor

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

You must login to add an answer.

Forgot Password?

Sidebar

Explore

  • Ask Question
  • Add Post

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
© 2022 OrclQA.Com. All Rights Reserved.
Privacy Policy - About Us