Question

There is a column as Price in my oracle apex tabular form. I need to calculate sum of all fields under this column and assign it to hidden field in Master form for validation. Actually there is a filed as Total_Price in master form. Value of this Total_Price field must be equals to sum of Price in detail form. but i don't know how to calculate sum of Price column in my oracle apex tabular form. how could i do this?

Was it helpful?

Solution

Since you want to do these when the Apply Changes button has been pressed, you can do it in a page process.

You need to identify which Apex array holds the data from that tabular form column - e.g. apex_application.g_f01, apex_application.g_f02, ... One way is to view the page source when running the page and look for the elements that make up the column. If they have the attribute name="f01" then the array you need is apex_application.g_f01, and so on.

Then simply write this code in the page process (I have assumed the array required is g_f01):

declare
   l_tot number := 0;
begin
   for i in 1..apex_application.g_f01.count loop
      l_tot := l_tot + nvl(to_number(apex_application.g_f01(i)),0);
   end loop;
   :p123_hidden_total := l_tot;
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top