Using Javascript to calculate a derived column in a tabular form

348 views Asked by At

So after doing some reading (and not quite understanding a few things) I'm wanting to find out more about derived columns in APEX reports.

The page has a tabular form which shows the tasks they have selected and they can select the time in hours (1-12) and minutes (15min intervals). What they input displays on a report which summarises the time they've allocated to a task from Monday to Friday and also gives a total down the bottom.

A request has been made to be able to not only see the totals for the day down the bottom but also the weekly total for each task on right so I've inserted a derived column.

In the page attributes under Javascript - Function and Global Variable Declaration, I have the following simple function:

var htmldb_delete_message = '"DELETE_CONFIRM_MSG"';

function sum_values(mon, tues, wed, thurs, fri, sat) {
  // pass page item names into the function
  // $v will get the value from the item name
  result = $v(mon) + $v(tues) + $v(wed) + $v(thurs) + $v(fri) + $v(sat);
  return result;
} 

and then in the derived column HTML attributes I have:

<script>
  sum_values(#MONDAY#, #TUESDAY#, #WEDNESDAY#, #THURSDAY#, #FRIDAY#, #SATURDAY#)
</script>

This is not displaying anything and I'm not sure what I'm doing wrong.

0

There are 0 answers