Titus Antony
Titus Antony

Reputation: 19

Dynamic Action does not get page item value - Apex 5.1

I have a page with 2 date fields and a button. A dynamic action with PLSQL code that references the value from the 2 date fields is created. For some reason, the page item values does not get passed in the dynamic action. When i use constant values, the DA works without any problem, but when i reference the item values, it doesn't work. No idea why. Can somebody please help??

I have included the DA (not working) code and the DA that works.

Not working DA

DECLARE
    I_VCNAME VARCHAR2(200);
    I_LPARAMS PK_JRXML2PDF_REPGEN.TPARAMLIST;
    I_VCDIR VARCHAR2(200);
    I_VCFILENAME VARCHAR2(200);
    bl BLOB;
BEGIN
    I_VCNAME:='Fundraiser_Stats';
    I_VCDIR := 'FUNDAMENTAL_FTP';
    I_LPARAMS(1).vcName:='date_from';
    I_LPARAMS(1).vcValue:=:R1_FROM_DATE;
    I_LPARAMS(2).vcName:='date_to';
    I_LPARAMS(2).vcValue:=:R1_TO_DATE;
    I_LPARAMS(3).vcName:='fundraiser';

    FOR fundraiser_name IN (SELECT DISTINCT B.FUNDRAISER fundraiser FROM WAYSACT_SRC_VW A, PLEDGE_EXT B WHERE A.PLEDGE_ID = B.PLEDGE_ID
                       AND A.PLEDGE_DATE BETWEEN :R1_FROM_DATE AND :R1_TO_DATE)
        LOOP
            I_LPARAMS(3).vcValue:= fundraiser_name.fundraiser;
            I_VCFILENAME := fundraiser_name.fundraiser||'-'||to_char(sysdate,'dd-Mon-yyyy')||'.pdf';
            PK_JRXML2PDF_REPGEN.PR_RUN_TO_FILE(I_VCNAME => I_VCNAME, I_LPARAMS => I_LPARAMS, I_VCDIR => I_VCDIR,I_VCFILENAME => I_VCFILENAME);
    END LOOP fundraiser_name;
    --APEX_APPLICATION.STOP_APEX_ENGINE;
END;

Working DA:

DECLARE
    I_VCNAME VARCHAR2(200);
    I_LPARAMS PK_JRXML2PDF_REPGEN.TPARAMLIST;
    I_VCDIR VARCHAR2(200);
    I_VCFILENAME VARCHAR2(200);
    bl BLOB;
BEGIN
    I_VCNAME:='Fundraiser_Stats';
    I_VCDIR := 'FUNDAMENTAL_FTP';
    I_LPARAMS(1).vcName:='date_from';
    I_LPARAMS(1).vcValue:='02-jun-2018';
    I_LPARAMS(2).vcName:='date_to';
    I_LPARAMS(2).vcValue:='02-jun-2018';
    I_LPARAMS(3).vcName:='fundraiser';

    FOR fundraiser_name IN (SELECT DISTINCT B.FUNDRAISER fundraiser FROM WAYSACT_SRC_VW A, PLEDGE_EXT B WHERE A.PLEDGE_ID = B.PLEDGE_ID
                       AND A.PLEDGE_DATE BETWEEN '02-jun-2018' AND '02-jun-2018')
        LOOP
            I_LPARAMS(3).vcValue:= fundraiser_name.fundraiser;
            I_VCFILENAME := fundraiser_name.fundraiser||'-'||to_char(sysdate,'dd-Mon-yyyy')||'.pdf';
            PK_JRXML2PDF_REPGEN.PR_RUN_TO_FILE(I_VCNAME => I_VCNAME, I_LPARAMS => I_LPARAMS, I_VCDIR => I_VCDIR,I_VCFILENAME => I_VCFILENAME);
    END LOOP fundraiser_name;
    --APEX_APPLICATION.STOP_APEX_ENGINE;
END;

Upvotes: 1

Views: 2308

Answers (1)

Littlefoot
Littlefoot

Reputation: 142720

This is the "Execute PL/SQL Code" dynamic action, is it not? Within DA's "Settings" section, there's the "Items to Submit" field - put names of all items you use in that code; I've noticed

R1_FROM_DATE, R1_TO_DATE

You'll know whether there are additional ones. If so, include them into the list.

Upvotes: 2

Related Questions