Does anyone has sample Anaplan Batch Script for importing timestamp value in anaplan?
Answers
-
This post might help you.
Regards,
0 -
@cookie clicker: Set input file path and filename
InputFile = "C:\data\timestamp_import.csv"Set Anaplan model and module information
ModelName = "My Model"
ModuleName = "My Module"
ListName = "My List"Set date/time format for timestamp column
DateTimeFormat = "yyyy-MM-dd HH:mm:ss"Import timestamp values from CSV file
ImportData
{
File = InputFile
Delimiter = ","
SkipHeader = trueini
Copy
Column "Timestamp"
{
Type = DateTime
Format = DateTimeFormatMap = ListName
}
}Validate and commit the import
ValidateImport
CommitImport
[/Anaplan Batch Script]This script assumes you have a CSV file named "timestamp_import.csv" with a column containing timestamp values. It sets the date/time format for the timestamp column, imports the data into the specified Anaplan model and module, and then validates and commits the import.
0 -
This will work too. A lot will depend on the command prompt you use in terms of formatting the date. This method uses the command line using windows. Also shows how to do in Python.
0 -
:: Set Anaplan Connect directory
set ANAPLAN_CONNECT_DIR=C:\path\to\anaplan-connect:: Set Anaplan credentials
set ANAPLAN_USER=your-email@example.com
set ANAPLAN_PASS=your-password:: Set Anaplan workspace and model information
set WORKSPACE_ID=your_workspace_id
set MODEL_ID=your_model_id:: Set the import action and the file to be uploaded
set IMPORT_ACTION=Import_Timestamp_Action
set FILE_TO_IMPORT=timestamp.csv:: Generate the timestamp
for /f "tokens=1-4 delims=/: " %%d in ("%date% %time%") do (
set timestamp=%%d-%%e-%%f %%g:%%h:%%i
):: Create the CSV file with the timestamp value
echo "Timestamp" > %FILE_TO_IMPORT%
echo "%timestamp%" >> %FILE_TO_IMPORT%:: Run the Anaplan Connect script to import the CSV file
cd %ANAPLAN_CONNECT_DIR%
call anaplan.bat -u %ANAPLAN_USER% -p %ANAPLAN_PASS% -workspace %WORKSPACE_ID% -model %MODEL_ID% -file %FILE_TO_IMPORT% -put %FILE_TO_IMPORT% -import %IMPORT_ACTION% -execute -output log.txt:: Clean up
del %FILE_TO_IMPORT%@echo on
- Set Variables:
- ANAPLAN_CONNECT_DIR: Path to the Anaplan Connect directory.
- ANAPLAN_USER and ANAPLAN_PASS: Your Anaplan credentials.
- WORKSPACE_ID and MODEL_ID: The identifiers for your Anaplan workspace and model.
- IMPORT_ACTION: The name of the import action in Anaplan that will handle the timestamp data.
- FILE_TO_IMPORT: The CSV file that will contain the timestamp value.
- Generate the Timestamp:
- The script captures the current date and time, formats it, and saves it into a CSV file.
- Run Anaplan Connect:
- The script calls the Anaplan Connect utility, uploads the generated CSV file to Anaplan, and executes the specified import action.
- Clean Up:
- After the import is complete, the script deletes the temporary CSV file.
0 - Set Variables: