Skip to Content
1
Former Member
Apr 03, 2014 at 07:59 PM

When to use *Commit (NW 10.0)

475 Views

Hello,

I just want to confirm something about how script sends data to the database. From what I've been reading lately, *COMMIT is only needed when using MDX or if needed within another function. Is this correct? So does *ENDALLOCATION and *ENDWHEN also commit records to the database? Related to that question then, does the more *ENDALLOCATIONS and *ENDWHEN's you have then make the script run slower because they each commit records to the database as they run?

For instance, would I need it in the following 2 places in this the following script.

The script finds the average Standard Cost of Sales per unit over the prior periods and then saves it to a single time period (YYYY.INP).

%MA% is prior periods that we want the average taken over

%CURPER% is the current period defined by the user

%DS% is a list of data sources


*RUNALLOCATION
*FACTOR=1
*DIM ACCOUNT WHAT = ZFACOSSTD; WHERE=STDCOSTPU1
*DIM TIME WHAT=%MA%; WHERE=%CURPER%
*DIM RPTCURRENCY WHAT=LC; WHERE=<<<
*DIM DATASRC WHAT= %DS%; WHERE=%DS%
*DIM CATEGORY WHAT= ACTUAL; WHERE=<<<
*ENDALLOCATION

*RUNALLOCATION
*FACTOR=1
*DIM ACCOUNT WHAT = UNIT_SHIPMENTS; WHERE=COUNTER
*DIM TIME WHAT=%MA%; WHERE=%CURPER%
*DIM RPTCURRENCY WHAT=LC; WHERE=<<<
*DIM DATASRC WHAT= %DS%; WHERE=%DS%
*DIM CATEGORY WHAT= ACTUAL; WHERE=<<<
*ENDALLOCATION
*COMMIT


*XDIM_MEMBERSET ACCOUNT = UNIT_SHIPMENTS,ZFACOSSTD,STDCOSTPU1
*XDIM_MEMBERSET CATEGORY = ACTUAL
*XDIM_MEMBERSET DATASRC = %DS%
*XDIM_MEMBERSET RPTCURRENCY = LC

// Calculate Unit Sales & Unit Cost of Sales and store it in Current Period
*WHEN TIME
*IS %CURPER%
*WHEN ACCOUNT

*IS STDCOSTPU1
*REC(EXPRESSION=%VALUE%/[ACCOUNT].[COUNTER])

*ENDWHEN
*ENDWHEN
*COMMIT

// Propogate Unit Cost of Sales to all Forecast Periods
*RUNALLOCATION
*FACTOR=1
*DIM ACCOUNT WHAT=STDCOSTPU1; WHERE=STDCOSTPU1, STDCOSTPU2
*DIM TIME WHAT=%CURPER%; WHERE=YYYY.INP
*DIM RPTCURRENCY WHAT=LC; WHERE=<<<
*DIM DATASRC WHAT= %DS%; WHERE=INPUT
*DIM CATEGORY WHAT= ACTUAL; WHERE=FORECAST_WIP
*ENDALLOCATION

Any thoughts on this? (@Vadim Kalinin I'd like to hear your thoughts as well if possible)

Thank You!

Alexander