I am struggling trying to figure out how to add a button to a row of data on my interactive grid that will execute a pl/sql procedure with a date parameter. The Page item doesn't seem to be populating, and it doesn't ‘seem’ to call the pl/sql code on button push. I have gone through several iterations and different routes from Ajax, jquery, fully javascript, and just dont understand why this seems so hard.
Here are my steps:
- I created an interactive grid with a select statement pulling a column named pool_date, which is a date.
2. I created the button column as an html expression with the Expression looking like this:
<button type='button' data-pool_date="&POOL_DATE!ATTR." class="t_Button t-Button--hot">Calc Profit-Loss</button>
3. Then, I created a Page Item to save off the Pool_Date column as a hidden item.
4. Then, I created a dynamic action for my button
Event Scope: Dynamic
Event: Selection Change(Region)
Selection Type: Region
Region: Weekly Pool
5. Then I have two True actions:
the First Action is an Execute JavaScript action with this code, which, I would think would set the Page Item's value
const model = this.data.model,
records = this.data.selectedRecords;
let values = records.map( r => model.getValue( r, "POOL_DATE" ) );
apex.item( "P126_POOL_DATE" ).setValue( values[0] );
Selection Type: Item
Item: P126_POOL_DATE
Sequence: 10
the Second Action is an execute Server Code action with this PL/SQL code:
begin
profit_loss_processing.weekly_distribution(:P126_POOL_DATE);
end;