2016-12-01 42 views
0

我們有一個Excel電子表格,它橫向考慮了所有的財務週期(13,一年加一個月)和垂直的文章代碼列表。交叉單元格包含使用Exact Online中的總帳交易記錄的該文章期間的已售數量。銷售交易的許多精確在線excel公式的表現

的商品代碼,庫存數量和銷售該列表是通過下面的查詢填充:

select code_attr 
,  '=i_eol_itm_description(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' rownum 
,  '=I_EOL_ITM_SALES_PRICE_VALUE(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' dateend 
,  '=I_EOL_ITM_COSTS_PRICE_VALUE(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' datestart 
,  '=I_EOL_ITM_SALES_UNIT_DESCRIPTION(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' assortment_glrevenue_code_attr 
,  '=$C{D,.,.,.+2,.}-$C{D,.,.,.+1,.}'        assortment_glrevenue_type_attr 
,  '=0' assortment_glrevenue_balanceside_attr 
,  '=I_EOL_STOCK_CURRENT_QUANTITY(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")' ispurchaseitem 
,  '=I_EOL_STOCK_PLANNING_IN(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")'  issalesitem 
,  '=I_EOL_STOCK_PLANNING_OUT(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")'  isstockitem 
,  '=I_EOL_STOCK_PROJECTED_QUANTITY(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")' assortment_glrevenue_balancetype_attr 
,  '=$C{D,.,.,.-1,.}*$C{D,.,.,.-5,.}' assortment_glrevenue_description 
... 
from exactonlinexml..items 
order 
by  code_attr 

750頁的文章和13週期間,總帳交易,訪問數千次。由於您需要首先下載銷售日記帳的所有交易,然後過濾掉沒有商品代碼(50%)的商品並將它們相加,那麼通過XML API在Exact Online中通過XML API檢索總帳交易信息的速度很慢銷售數量。

運行時間爲45分鐘,而當Exact Online API速度慢時更是如此。

如何縮短填寫電子表格所需的時間?

回答

0

通過在模型級別使用觸發器,對於指示的數據量,運行時間減少到幾分鐘。該觸發器觸發使用了精確的在線REST API來檢索的GL交易信息總結數量SQL語句:

create or replace table [email protected] 
as 
select itemcode 
,  mnd 
,  sum(qty) qty 
from (select itemcode 
     ,  year(date) * 12 + month(date) mnd 
     ,  quantity qty 
     from TransactionLines 
     where journalcode = '70' 
     and itemcode is not null 
     and date > to_date('20160101', 'yyyymmdd') 
     ) 
group 
by  itemcode 
,  mnd 

然後,而不是使用Excel公式I_EOL_GLTXN,我用下面的公式:

select code_attr 
,  '=i_eol_itm_description(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' rownum 
,  '=I_EOL_ITM_SALES_PRICE_VALUE(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' dateend 
,  '=I_EOL_ITM_COSTS_PRICE_VALUE(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' datestart 
,  '=I_EOL_ITM_SALES_UNIT_DESCRIPTION(eoldivision,$C{D,.,.,^,.},"ALL_ROWS")' assortment_glrevenue_code_attr 
,  '=$C{D,.,.,.+2,.}-$C{D,.,.,.+1,.}'        assortment_glrevenue_type_attr 
,  '=0' assortment_glrevenue_balanceside_attr 
,  '=I_EOL_STOCK_CURRENT_QUANTITY(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")' ispurchaseitem 
,  '=I_EOL_STOCK_PLANNING_IN(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")'  issalesitem 
,  '=I_EOL_STOCK_PLANNING_OUT(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")'  isstockitem 
,  '=I_EOL_STOCK_PROJECTED_QUANTITY(eoldivision,$C{D,.,.,^,.},,"ALL_ROWS")' assortment_glrevenue_balancetype_attr 
,  '=$C{D,.,.,.-1,.}*$C{D,.,.,.-5,.}' assortment_glrevenue_description 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & m$11)' assortment_glcosts_code_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & n$11)' assortment_glcosts_type_att 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & o$11)' assortment_glcosts_balanceside_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & p$11)' assortment_glcosts_balancetype_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & q$11)' assortment_glcosts_description 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & r$11)' assortment_glpurchase_code_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & s$11)' assortment_glpurchase_type_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & t$11)' assortment_glpurchase_balanceside_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & u$11)' assortment_glpurchase_balancetype_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & v$11)' assortment_glpurchase_description 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & w$11)' assortment_glpurchasepricedifference_code_attr 
,  '=i_sql_select_scalar("qty", "[email protected]", "itemcode=' || chr(39) || '" & $C{D,.,.,^,.} & "' || chr(39) || ' and mnd = " & x$11)' assortment_glpurchasepricedifference_type_attr 
,  '=SUM($C{D,.,.,.-12,.}:$C{D,.,.,.-1,.})' assortment_glpurchasepricedifference_balanceside_attr 
,  '=$C{D,.,.,.-1,.}/12' assortment_glpurchasepricedifference_balancetype_attr 
from exactonlinexml..items 
order 
by  code_attr 

i_sql_select_scalar從總表中檢索精確的在線銷售數量,總數。

all_rows作爲執行提示添加到諸如I_EOL_STOCK_CURRENT_QUANTITY之類的公式中,強制將所有項目作爲評估的第一個公式中的一個大批次加載到內存中。儘管計算第一個公式需要更長的時間,但它的速度要快得多。現在大約需要1分鐘時間才能在Excel中填寫項目信息,而不是每個項目750個檢索項目(XML API有時每個項目最多需要600 ms)。