Abdullah
Abdullah

Reputation: 1033

Why some columns not updated when save changes in Interactive Grid?

I have interactive grid in oracle apex this is the grid query :

select id ,
       patient_no,
       sample_id ,
       test_no , 
       test_result , 
       machine_id , 
       RANGE_FROM ,
       RANGE_TO , 
       RANGE_TEXT , 
       NORMAL_RESULT,
       EXAMINED_BY,
       EXAMINED_DATE,
       SAMPLE_STATUS
       from lab_results
       where section_id = :P69_SECTION_ID 
       and sample_id = :P69_SAMPLE_ID

and this is the code in save process :

DECLARE
    CURSOR c1 IS 
        SELECT REGEXP_SUBSTR(:P69_TEST_NO, '[^,]+', 1, LEVEL) AS TESTNO
        FROM DUAL
        CONNECT BY LEVEL <= REGEXP_COUNT(:P69_TEST_NO, ',') + 1;
BEGIN
    FOR i IN c1 LOOP -- Update LAB_RESULTS

        UPDATE LAB_RESULTS 
       SET TEST_RESULT = :TEST_RESULT , 
       MACHINE_ID = :MCAHINE_ID , 
       EXAMINED_BY = :P0_USERNAME , 
       EXAMINED_DATE = SYSDATE ,
       RANGE_FROM = :RANGE_FROM , 
       RANGE_TO = :RANGE_TO
   WHERE TEST_NO = i.TESTNO
   AND SAMPLE_ID = :P69_SAMPLE_ID;

        
    END LOOP;
END;
 

when click SAVE button its updating all columns in LAB_RESULTS table but these 2 columns not updating

   EXAMINED_BY = :P0_USERNAME , 
   EXAMINED_DATE = SYSDATE ,
 

also I tried to put static value but not saving like this

   EXAMINED_BY = 'ABCD' , 
   EXAMINED_DATE = '01/01/2025' ,

what is the reason please and if you need more information's I will add it thank you in advance.

Upvotes: 0

Views: 31

Answers (1)

Abdullah
Abdullah

Reputation: 1033

I solved it by using interactive grid update functionality this is the code:

BEGIN
 CASE :APEX$ROW_STATUS  
    WHEN 'U' THEN  
        UPDATE LAB_RESULTS 
       SET TEST_RESULT = :TEST_RESULT , 
       MACHINE_ID = :MACHINE_ID , 
       EXAMINED_BY = :APP_USER , 
       EXAMINED_DATE = sysdate ,
       RANGE_FROM = :RANGE_FROM , 
       RANGE_TO = :RANGE_TO,
       SAMPLE_STATUS = 4 
   WHERE TEST_NO IN (SELECT REGEXP_SUBSTR(:P69_TEST_NO, '[^,]+', 1, LEVEL) AS TESTNO
                        FROM DUAL
                        CONNECT BY LEVEL <= REGEXP_COUNT(:P69_TEST_NO, ',') + 1)
   AND ID = :ID;
    END CASE;
END;
 

Upvotes: 0

Related Questions