Scenario - Part One: I have a tabular form (and corresponding table) with 3 columns A, B, & C whose query is simply:
SELECT A, B, C
FROM <table>;
Both column A & column B are input text fields, and column C is display-only but calculated at submit time with my own MRU thus:
UPDATE <table>
SET A = :A,
B = :B,
C = :A + :B
WHERE ROWID = :ROWID;
I can type in figures to columns A & B to my heart's content and have their sum calculated in C when the 'Apply Changes' button is pressed, for all rows on-screen at submit time.
This works a treat & does exactly what I intended, giving a spread-sheet kinda feel.
Scenario - Part Two:
After an external event has occured (in this case the user chooses to finalise a day's work by clicking a button which in turn fires the MRU processing above before calling a DB procedure to put a date/time in a header record), I would like to make Column A non-inputable.
(I have a trigger on the table now preventing any actual change to column A, but I want the TF to behave accordingly).
So I modify column A to be 'Standard Report Column', and change my query to:
SELECT DECODE(<finalised date condition>, NULL, APEX_ITEM.TEXT(1, A), A) AS A,
B, C
FROM <table>;
This makes column A inputable when the day has not been finalised, and non-inputable (ie; display only) when it has been. All is hunky-dory!
But when I submit any changes to column A, column A loses its data. Ie; it appears that the data is not saved in session state, and any changes to it are nulled on return (although column C is still correctly calculated by the MRU & saved).
So my question is: How do I make this behave properly? How do I make column A save its data when using APEX_ITEM.TEXT ?
(Running Apex 5.0.3.00.03).