Skip to content

Latest commit

 

History

History
98 lines (77 loc) · 3.05 KB

}bedrock.server.savedataall.md

File metadata and controls

98 lines (77 loc) · 3.05 KB

#region Prolog #Region CallThisProcess

A snippet of code provided as an example how to call this process should the developer be working on a system without access to an editor with auto-complete.

If( 1 = 0 ); ExecuteProcess( '}bedrock.server.savedataall', 'pLogOutput', pLogOutput, 'pStrictErrorHandling', pStrictErrorHandling ); EndIf; #EndRegion CallThisProcess

#*Begin: Generated Statements #End: Generated Statements

################################################################################################# ##Join the bedrock TM1 community on GitHub https://github.com/cubewise-code/bedrock Ver 4.0## #################################################################################################

#Region @DOC

Description:

This process will Save All Data to disk.

Use case: Intended for production.

1/ This could be run mulitple times a day during the planning cycle.

Note:

Depending on how long since the last data save this could take several seconds if not minutes so schedule if over lunch break.

#EndRegion @DOC

Global Variables

StringGlobalVariable('sProcessReturnCode'); NumericGlobalVariable('nProcessReturnCode'); nProcessReturnCode= 0;

Constants

cThisProcName = GetProcessName(); cUserName = TM1User(); cMsgErrorLevel = 'ERROR'; cMsgErrorContent = 'User:%cUserName% Process:%cThisProcName% ErrorMsg:%sMessage%';

LogOutput parameters

Validate Parameters

nErrors = 0;

LogOutput

If( pLogOutput = 1 ); sLogInfo = Expand('Process:%cThisProcName% commenced.'); LogOutput( 'INFO', sLogInfo ); nStart = Now(); EndIf;

Save Data

SaveDataAll; #endregion #region Metadata

#*Begin: Generated Statements #End: Generated Statements #endregion #region Data

#*Begin: Generated Statements #End: Generated Statements #endregion #region Epilog

#*Begin: Generated Statements #End: Generated Statements

LogOutput

If( pLogOutput = 1 ); sSec = NumberToStringEx( 86400*(Now() - nStart),'#,##0.0', '.', ',' ); sLogInfo = Expand('Process:%cThisProcName% completed. Elapsed time %sSec% seconds.'); LogOutput( 'INFO', sLogInfo ); EndIf;

Return code & final error message handling

If( nErrors > 0 ); sMessage = 'the process incurred at least 1 error. Please see above lines in this file for more details.'; nProcessReturnCode = 0; LogOutput( cMsgErrorLevel, Expand( cMsgErrorContent ) ); sProcessReturnCode = Expand( '%sProcessReturnCode% Process:%cThisProcName% completed with errors. Check tm1server.log for details.' ); If( pStrictErrorHandling = 1 ); ProcessQuit; EndIf; Else; sProcessAction = Expand( 'Process:%cThisProcName% successfully saved all cube data.' ); sProcessReturnCode = Expand( '%sProcessReturnCode% %sProcessAction%' ); nProcessReturnCode = 1; If( pLogoutput = 1 ); LogOutput('INFO', Expand( sProcessAction ) );
EndIf; EndIf;

End Epilog

#endregion