Computation in Oracle Apex not returning expected result
<p>I am getting confused about computation points, such as before_header and after_header etc.</p>

<p>I have a computation, which needs to take a page item value, and then return as result.</p>

<p>The computation is a PL/SQL Function Body as below:</p>

<pre><code>DECLARE
   v_response varchar2(1500);
BEGIN
  IF :P4_RENEWAL_REQUIRED = 'Yes' THEN
        v_response := 'According to Register, a license renewal WILL BE required to maintain this registration. Please choose whether you agree or disagree with this statement.';
 ELSE
       v_response:='Forget about it...';
 END IF;
  return v_response;
END;
</code></pre>

<p>The page item :P4_RENEWAL_REQUIRED is a calculated field which is a SQL value, which relies on a database populated page item P4_RENEWAL_NOT_REQUIRED.  It simply turns a Yes to a No and a No to Yes.</p>

<pre><code>SELECT (CASE WHEN V('P4_RENEWAL_NOT_REQUIRED')='Yes' Then 'No' ELSE 
CASE WHEN  V('P4_RENEWAL_NOT_REQUIRED')='No' Then 'Yes' ELSE '??' END END) FROM DUAL
</code></pre>

<p>My computation will not return the result.  The P4_RENEWAL_REQUIRED value will be clearly 'Yes' but the computation will return 'Forget about it'.  If I go into page edit view, and then run the page again - the value shows the correct value of </p>

<p>'According to Register, a license renewal WILL BE required to maintain this registration. Please choose whether you agree or disagree with this statement.'</p>

<p>This implies to me that the computation is operating on an old session value of P4_RENEWAL_REQUIRED.</p>

<p>I am not really sure what the computation points have to do with this, but if I have data being returned via a Fetch Row process executing on After Header, which then is populating the fields in the regions such as P4_RENEWAL_NOT_REQUIRED, and then P4_RENEWAL_REQUIRED is being calculated....how do I get a computation to populate a field in another region which has a dependency on the existing page items?</p>

<p>I have tried making my computation execute before footer, before regions, after footer etc. but nothing works.</p>

<p>I am not sure how all the Before Footer works, or how the page items get populated in which point, when all of this is rendered server side.</p>

<p>For example if I set my computation to calculate "After Region" is it too late to then use that value IN a region as the regions have already been rendered?</p>

<p>If I need to calculate a value in my computation to use it in a region and use "Before Region" computation point, have the page items I need to use been tied to the page items by the underlying query at that point or am I too early.</p>

<p>Any help appreciated.</p>