Hi Orlando,
sure i can post the original process, the DataCount is for counting the not 100% Values, but i think i should use a boolen or just 1 or 0, cause its just for the E-mail Output (Errors found or not)
Prolog:
Code: Select all
#Output Setup
sRunID = STR( NOW(), 8, 5 );
DataSourceAsciiQuoteCharacter = '"';
DataSourceAsciiDelimiter = ';';
logPath = 'D:\Planning_Analytics\Custom_Logs\Logger\MandantenSchluesselAuwertung_' | sRunID | '.csv';
#Const Cube String
cCube = 'Mengen-Planung Monat Mandant ab 2019';
#Counters
nDataCount = 0;
#Create View
ViewCreate(cCube, 'tmpSchlüsselCheck_' | sRunID, 1);
#Create Subset for Mandant dimension with Sum of Mandant
SubsetCreate('Mandant', 'tmpSummeMandant_' | sRunID, 1);
#Add element to tmp Mandant Subset
SubsetElementInsert('Mandant', 'tmpSummeMandant_ ' | sRunID, 'Summe Mandanten', 0);
#Create tmp Subset for Kennzahlen
SubsetCreate('Kennzahlen Mengen-Planung Monat Mandant ab 2019', 'tmpSchlüsselCheck_' | sRunID, 1 );
#Insert Schlüsssel elements to Subset
SubsetElementInsert('Kennzahlen Mengen-Planung Monat Mandant ab 2019', 'tmpSchlüsselCheck_' | sRunID, 'Schlüssel %', 0);
SubsetElementInsert('Kennzahlen Mengen-Planung Monat Mandant ab 2019', 'tmpSchlüsselCheck_' | sRunID, 'bearbeitete Kontakte %', 1);
#Create tmp Subset for Jahre
SubsetCreate('Jahre', 'tmpJahreSchlüsselCheck_' | sRunID, 1);
SubsetElementInsert('Jahre', 'tmpJahreSchlüsselCheck_' | sRunID, pJahr, 0);
#Create tmp Subset for Version
SubsetCreate('Version', 'tmpVersionSchlüsselCheck_' | sRunID, 1);
SubsetElementInsert('Version', 'tmpVersionSchlüsselCheck_' | sRunID, pVersion, 0);
#Assign Subsets to View
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Planungseinheit', 'Alle n Level' );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Kennzahlen Mengen-Planung Monat Mandant ab 2019', 'tmpSchlüsselCheck_' | sRunID );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Kontaktart', 'n_Kontaktarten Gesamt' );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Jahre', 'tmpJahreSchlüsselCheck_' | sRunID );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Monat', 'Monate_N_Level' );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Mandant', 'tmpSummeMandant_' | sRunID );
ViewSubsetAssign( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Version', 'tmpVersionSchlüsselCheck_' | sRunID );
#Sort Rows and Columns
ViewColumnDimensionSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Monat', 1 );
ViewColumnDimensionSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Kennzahlen Mengen-Planung Monat Mandant ab 2019', 2 );
ViewColumnDimensionSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Kontaktart', 3 );
ViewRowDimensionSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Planungseinheit', 1 );
#Setup Title Dims
ViewTitleDimensionSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 'Mandant' );
#SuppressZeros and dont skip consolidated objects
ViewExtractSkipCalcsSet(cCube, 'tmpSchlüsselCheck_' | sRunID, 0);
ViewSuppressZeroesSet( cCube, 'tmpSchlüsselCheck_' | sRunID, 1 );
#Switch datasource
DataSourceType = 'VIEW';
DatasourceNameForServer = cCube;
DatasourceCubeview = 'tmpSchlüsselCheck_' | sRunID;
Data:
Code: Select all
sWert = NUMBERTOSTRINGEX(Wert,'#.##############', ',','.');
nWert = StringToNumber(sWert);
IF(nWert <> 1);
ASCIIOutput(logPath , Jahre, Version, Monat, Planungseinheit, Kontaktart, V6, sWert);
nDataCount = nDataCount +1;
ENDIF;
Epilog:
Code: Select all
IF(nDataCount > 0);
ExecuteProcess('System_SendHTMLmail', 'pRecipient', pEmail, 'pSubject', 'Automatische Mandanten Schlüssel Auswertung', 'pBody', 'Im Anhang befindet sich die automatische Mandanten Schlüssel Auswertung mit der ID ' | sRunID | '.','pAttachFile', logPath, 'pTitle', 'Automatische Mandanten Schlüssel Auswertung - ID ' | sRunID | '.');
nTime = NOW();
nStartNow = nTime;
nWaitTime = nStartNow + ( StringToNumber( '3' ) / 86400 );
WHILE( nTime <= nWaitTime );
nTime = NOW();
END;
ASCIIDelete(logPath);
ELSE;
ExecuteProcess('System_SendHTMLmail', 'pRecipient', pEmail, 'pSubject', 'Automatische Mandanten Schlüssel Auswertung', 'pBody', 'Alle Schlüssel sind auf 100% geplant!.','pAttachFile', '', 'pTitle', 'Automatische Mandanten Schlüssel Auswertung - ID ' | sRunID | '.');
ENDIF;
I'm sorry if the code is a lil bit weird, i try to get more practice in TI Scripting.
Edit: Wert = Value in German, should i also avoid this? Didnt know it yet, then i have to rename the variables. thanks for the hint!
Thanks for your help!
BR