Oracle APEX cannot save a value into a session










2














I have a page item P2_ITEM_TYPE_ID that gets set in Pre-Render, using a process calling PL/SQL:



BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;


Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.



Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.



I have a dynamic action that runs the following javascript when card is clicked:



var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value

//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",

x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
,
dataType: 'text' );


I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?



It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:



BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;


But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue










share|improve this question























  • I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
    – romeuBraga
    Nov 13 at 5:38
















2














I have a page item P2_ITEM_TYPE_ID that gets set in Pre-Render, using a process calling PL/SQL:



BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;


Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.



Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.



I have a dynamic action that runs the following javascript when card is clicked:



var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value

//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",

x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
,
dataType: 'text' );


I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?



It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:



BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;


But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue










share|improve this question























  • I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
    – romeuBraga
    Nov 13 at 5:38














2












2








2







I have a page item P2_ITEM_TYPE_ID that gets set in Pre-Render, using a process calling PL/SQL:



BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;


Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.



Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.



I have a dynamic action that runs the following javascript when card is clicked:



var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value

//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",

x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
,
dataType: 'text' );


I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?



It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:



BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;


But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue










share|improve this question















I have a page item P2_ITEM_TYPE_ID that gets set in Pre-Render, using a process calling PL/SQL:



BEGIN
select ITEM_TYPE_ID INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;
exception
when no_data_found then
:P2_ITEM_TYPE_ID := null;
END;


Currently the record for that ITEM_ID does not exist in TABLE1 so the exception NO_DATA_FOUND is thrown and originally the ITEM_TYPE_ID is set to null.



Now I want to set the ITEM_TYPE_ID by clicking on one of the cards on the page, grabbing its ID and setting page item P2_ITEM_TYPE_ID to that ID.



I have a dynamic action that runs the following javascript when card is clicked:



var $item_type_id = this.data;
console.log($item_type_id); //prints out correect ID
apex.item("P2_ITEM_TYPE_ID").setValue($item_type_id);
console.log(apex.item("P2_ITEM_TYPE_ID").getValue()); //prints out correct value

//set session state of P2_ITEM_TYPE_ID
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE",

x01: $item_type_id,
pageItems: "#P2_ITEM_TYPE_ID"
,
dataType: 'text' );


I know the code works, as the correct values get printed to the console, but when I check the session of the page, P2_ITEM_TYPE_ID is blank in session. What could be the problem?



It is almost as if something is preventing th value from changing.
I have identical setup on another page with one small difference - the code in the pre-render does not include the exception part because there is always a record in TABLE1 for that ITEM_ID:



BEGIN
select ITEM_TYPE_ID INTO :P3_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P3_ITEM_ID;
END;


But the rest of the code is identical and session of P3_ITEM_TYPE_ID changes without an issue







oracle oracle-apex oracle-apex-5.1






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 21:02









Littlefoot

20.3k71433




20.3k71433










asked Nov 12 at 20:43









Coding Duchess

2,38462883




2,38462883











  • I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
    – romeuBraga
    Nov 13 at 5:38

















  • I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
    – romeuBraga
    Nov 13 at 5:38
















I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 at 5:38





I think is the "session state protection" propertie, you need to set to unrestricted. previously I was thinking you are calling some process with apex_server.process, but SAVE_HIDDEN_VALUE_IN_SESSION_STATE is just a descritive name, right? there isn't a callback process with that name? You are using apex.server.process just to send the value to session, in this case I think the problem is that propertie in the item, if you change to unrestricted, should be works.
– romeuBraga
Nov 13 at 5:38













2 Answers
2






active

oldest

votes


















3














You don't need apex.server.process for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID) in the Items to Submit attribute (set PL/SQL Code to just null;).






share|improve this answer




















  • But of course! Nice trick!
    – Littlefoot
    Nov 13 at 5:57


















1














If everything is the same on those pages, except the EXCEPTION part, well - there's a workaround: use an aggregate function, e.g.



select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;


It will prevent the query from returning NO_DATA_FOUND if there's no value for that :P2_ITEM_ID and will store NULL into the :P2_ITEM_TYPE_ID.






share|improve this answer




















  • While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
    – Coding Duchess
    Nov 12 at 21:29










  • I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
    – Coding Duchess
    Nov 12 at 21:31






  • 1




    Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
    – Littlefoot
    Nov 12 at 21:31










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269800%2foracle-apex-cannot-save-a-value-into-a-session%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














You don't need apex.server.process for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID) in the Items to Submit attribute (set PL/SQL Code to just null;).






share|improve this answer




















  • But of course! Nice trick!
    – Littlefoot
    Nov 13 at 5:57















3














You don't need apex.server.process for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID) in the Items to Submit attribute (set PL/SQL Code to just null;).






share|improve this answer




















  • But of course! Nice trick!
    – Littlefoot
    Nov 13 at 5:57













3












3








3






You don't need apex.server.process for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID) in the Items to Submit attribute (set PL/SQL Code to just null;).






share|improve this answer












You don't need apex.server.process for this, you can post the value of an item to the server with an Execute PL/SQL Code action that follows the javascript action you already have. Put the item name (e.g. P2_ITEM_TYPE_ID) in the Items to Submit attribute (set PL/SQL Code to just null;).







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 at 2:16









Jeffrey Kemp

47.8k1187131




47.8k1187131











  • But of course! Nice trick!
    – Littlefoot
    Nov 13 at 5:57
















  • But of course! Nice trick!
    – Littlefoot
    Nov 13 at 5:57















But of course! Nice trick!
– Littlefoot
Nov 13 at 5:57




But of course! Nice trick!
– Littlefoot
Nov 13 at 5:57













1














If everything is the same on those pages, except the EXCEPTION part, well - there's a workaround: use an aggregate function, e.g.



select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;


It will prevent the query from returning NO_DATA_FOUND if there's no value for that :P2_ITEM_ID and will store NULL into the :P2_ITEM_TYPE_ID.






share|improve this answer




















  • While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
    – Coding Duchess
    Nov 12 at 21:29










  • I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
    – Coding Duchess
    Nov 12 at 21:31






  • 1




    Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
    – Littlefoot
    Nov 12 at 21:31















1














If everything is the same on those pages, except the EXCEPTION part, well - there's a workaround: use an aggregate function, e.g.



select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;


It will prevent the query from returning NO_DATA_FOUND if there's no value for that :P2_ITEM_ID and will store NULL into the :P2_ITEM_TYPE_ID.






share|improve this answer




















  • While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
    – Coding Duchess
    Nov 12 at 21:29










  • I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
    – Coding Duchess
    Nov 12 at 21:31






  • 1




    Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
    – Littlefoot
    Nov 12 at 21:31













1












1








1






If everything is the same on those pages, except the EXCEPTION part, well - there's a workaround: use an aggregate function, e.g.



select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;


It will prevent the query from returning NO_DATA_FOUND if there's no value for that :P2_ITEM_ID and will store NULL into the :P2_ITEM_TYPE_ID.






share|improve this answer












If everything is the same on those pages, except the EXCEPTION part, well - there's a workaround: use an aggregate function, e.g.



select max(ITEM_TYPE_ID) INTO :P2_ITEM_TYPE_ID from TABLE1 where ITEM_ID = :P2_ITEM_ID;


It will prevent the query from returning NO_DATA_FOUND if there's no value for that :P2_ITEM_ID and will store NULL into the :P2_ITEM_TYPE_ID.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 at 21:02









Littlefoot

20.3k71433




20.3k71433











  • While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
    – Coding Duchess
    Nov 12 at 21:29










  • I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
    – Coding Duchess
    Nov 12 at 21:31






  • 1




    Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
    – Littlefoot
    Nov 12 at 21:31
















  • While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
    – Coding Duchess
    Nov 12 at 21:29










  • I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
    – Coding Duchess
    Nov 12 at 21:31






  • 1




    Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
    – Littlefoot
    Nov 12 at 21:31















While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 at 21:29




While this did help me to get rid of unnecessary line for catching exception in pre-render, it still did not populate P2_ITEM_TYPE_ID, unfortunatelly.
– Coding Duchess
Nov 12 at 21:29












I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 at 21:31




I created an additional page item - P2_ITEM_TYPE_ID2 on the page and filled by adding one exta line to my javascript - apex.item("P2_ITEM_TYPE_ID2").setValue($item_type_id); and it worked fine. How come P2_ITEM_TYPE_ID does not get populated in session?:(
– Coding Duchess
Nov 12 at 21:31




1




1




Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 at 21:31




Apparently, that wasn't the only difference between those two pages. Check whether types of P2_ITEM_TYPE_ID and P3_ITEM_TYPE_ID is equal; actually, compare all their properties.
– Littlefoot
Nov 12 at 21:31

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53269800%2foracle-apex-cannot-save-a-value-into-a-session%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党