I am trying to create a button or something to be able to truncate a table and reload the data.
i.e. refreshing…
I tried using a blank application…
though I dont like that option, would like to get feedbak to user that process completed.
I can run the process in a the sql workbench and it reloads fine.
But when I added it to a sc_exec_sql macro it fails…
Anyone have an idea why or another solution…
sql I am running is below:
sc_exec_sql("truncate table materialized_view_all_claims;
insert into materialized_view_all_claims
(con_name,bat_invoice,clm_claimid,clm_type,tb_2,tb_1,bat_date,charges_total,medicare_allowable_total,
billable_total,payable_total)
(select con_name,bat_invoice,clm_claimid,clm_type,tb_2,tb_1,DATE_FORMAT(`bat_date`,'%Y-%m-%d'),
sum(ifnull(clm_charges,0) + ifnull(cla_charges,0)),
sum(ifnull(clm_allowable,0) + ifnull(cla_allowable,0)),
sum(ifnull(clm_billable,0) + ifnull(cld_billable,0) + ifnull(cla_billable,0)) as billable,
sum(ifnull(clm_payable,0) + ifnull(cld_payable,0) + ifnull(cla_payable,0)) as payable
from imsprism.v_prism_reporting_all_claims
group by con_name,bat_invoice,clm_type,tb_2,tb_1,clm_claimid)");