Current system day or To Date

Hi Guys,

 

Can anyone please guide, if we have any syntax for retriving todays date i,e sysdate in Anaplan.

I have created a property with Date formatted,I want to view todays date in this line item.

 

Thanks

Madhabika

Comments

  • Hello Madhabika,

     

     

    @echo on
    :: This script looks up the current date, writes it to a csv file, and sends it to Anaplan

    :: Here we set the file path of the csv file we will be writing the current date too
    set FileName="\\d-sapfiles\Interfaces\D_ANAPLAN\VOLFCST\OUT\CurrentDate.csv"

    :: rem This is a simple for loop that parses the date /t function
    FOR /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set mm=%%a& set dd=%%b& set yyyy=% %c& (if "%%a:~0,1" gtr "9" set mm=%%b& set dd=%%c& set yyyy=%%d))

    echo Todays date in Windows format is: %date%

    set mydate=%yyyy%-%mm%-%dd%
    echo 'Current Date': %mydate%

    rem The following is not needed unless you have specific requirements to strip characters, etc
    :: rem Remove leading Zeros from Day
    :: set d=%dd%
    :: set /a d=100%d% %% 100
    :: rem Remove leading Zeros from Month
    :: set m=%mm%
    :: set /a m=100%m% %% 100
    :: set snapshot=%d%-%m%-%yyyy%

    set snapshot=%mydate%
    echo 'Latest Snapshot': %snapshot%

    @echo "Current Date","Latest Snapshot"> %FileName%
    @echo "%mydate%","%snapshot%">> %FileName%

    rem **************************************************************

    set AnaplanUser=“XXX@anaplan.com"
    set WorkspaceId=“XXX”
    set ModelId=“XXX”
    :: This variable AC_exe should be set to the path of the AnaplanClient.bat
    set AC_exe=D:\Anaplan\AnaplanClient.bat
    :: This variable Cert should be set to the path of your Anaplan User's Certificate (can be downloaded from Anaplan under user profile on the top right)
    set Cert="D:\Anaplan\certificate-XXXX.cer"
    :: This variable LogPath should be set to the path of a folder/directory for the Anaplan Connect log files
    set LogPath="D:\Anaplan\logs"

    set Operation=-certificate %Cert% -file "CurrentDate.csv NOTE: This is the filename in the Anaplan Model when you click on Import Data Sources button" -put %FileName% -import "Import Current Date NOTE: This is the name of the Import Action in the Anaplan Model" -execute -output %LogPath%

    rem *** End of settings - Do not edit below this line ***

    setlocal enableextensions enabledelayedexpansion || exit /b 1
    cd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=%AC_exe% %Credentials% -s %ServiceLocation% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command%
    pause

    save it with .bat extension and you can use it.

     

    The actual code was in the other post.

    I've made it available here. Thank you!

  • I can't get this code to update my module:

     

    @echo on
    :: This script looks up the current date, writes it to a csv file, and sends it to Anaplan
    
    :: Here we set the file path of the csv file we will be writing the current date too
    set FileName="C:\Users\tobrien\Desktop\HDCCO\Scripts\Current Date.txt"
    
    :: rem This is a simple for loop that parses the date /t function
    FOR /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set mm=%%a& set dd=%%b& set yyyy=% %c& (if "%%a:~0,1" gtr "9" set mm=%%b& set dd=%%c& set yyyy=%%d))
    
    echo Todays date in Windows format is: %date%
    
    set mydate=%yyyy%-%mm%-%dd%
    echo 'Current Date': %mydate%
    
    rem The following is not needed unless you have specific requirements to strip characters, etc
    :: rem Remove leading Zeros from Day
    :: set d=%dd%
    :: set /a d=100%d% %% 100
    :: rem Remove leading Zeros from Month
    :: set m=%mm%
    :: set /a m=100%m% %% 100
    :: set snapshot=%d%-%m%-%yyyy%
    
    set snapshot=%mydate%
    echo 'Latest Snapshot': %snapshot%
    
    @echo "Current Date"> %FileName%
    @echo "%mydate%">> %FileName%
    
    rem **************************************************************
    
    set AnaplanUser=“tobrien@allitix.com"
    set WorkspaceId=“8a81b09b652b035001653afaa0584473”
    set ModelId=“61E67CEB032C4CD4BA1E1E489D1A16E4”
    :: This variable AC_exe should be set to the path of the AnaplanClient.bat
    set AC_exe=C:\Users\tobrien\Desktop\HDCCO\Batch\AnaplanClient.bat
    :: This variable Cert should be set to the path of your Anaplan User's Certificate (can be downloaded from Anaplan under user profile on the top right)
    set Cert="C:\Users\tobrien\Desktop\HDCCO\Cert"
    :: This variable LogPath should be set to the path of a folder/directory for the Anaplan Connect log files
    set LogPath="C:\Users\tobrien\Desktop\HDCCO"
    
    set Operation=-certificate %Cert% -file "Current Date.txt NOTE: This is the filename in the Anaplan Model when you click on Import Data Sources button" -put %FileName% -import "Import Current Date NOTE: This is the name of the Import Action in the Anaplan Model" -execute -output %LogPath%
    
    rem *** End of settings - Do not edit below this line ***
    
    setlocal enableextensions enabledelayedexpansion || exit /b 1
    cd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=%AC_exe% %Credentials% -s %ServiceLocation% -workspace %WorkspaceId% -model %ModelId% %Operation%
    @echo %Command%
    cmd /c %Command%
    pause