Hello All,
I want to use substitution variable to fetch the value of strat month and end month,so that hardcore value is not requireinto my batch file and no need to update start and end period value every month, for monthly data load.
I have created the script for the same but while running the batch file I ma getting error at "epmautomate rundatarule" syntex.
Pleas find the below script for the same and let me know if I am doing worong some where.
@echo off
rem EPM Automate Start Year and Month
call epmautomate login %User% %Pass% %URL%
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (` "call epmautomate getsubstvar ALL name=CurrYr" `) DO (
SET var!count!=%%F
SET /a count=!count!+1
)
ECHO %var2%
SET YearS=%var2:~13,2%
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (` "call epmautomate getsubstvar ALL name=CurrMth" `) DO (
SET var!count!=%%F
SET /a count=!count!+1
)
ECHO %var2%
SET MonthS=%var2:~13,3%
ECHO MonthS: %MonthS%
ECHO YearS: %YearS%
ECHO MonthS: %MonthS%-%YearS%
ENDLOCAL
rem EPM Automate End Year and Month
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (` "call epmautomate getsubstvar ALL name=EndYr" `) DO (
SET var!count!=%%F
SET /a count=!count!+1
)
ECHO %var2%
SET YearE=%var2:~12,2%
SET count=1
FOR /F "tokens=* USEBACKQ" %%F IN (` "call epmautomate getsubstvar ALL name=EndMth" `) DO (
SET var!count!=%%F
SET /a count=!count!+1
)
ECHO %var2%
SET MonthE=%var2:~12,3%
ECHO MonthE: %MonthE%-%YearE%
call epmautomate rundatarule "HeadCount_DataRule" %MonthS%-%YearS% %MonthE%-%YearE% REPLACE STORE_DATA inbox/"abc.csv"
ENDLOCAL
PAUSE
------------------------------------------------------------------------------------------------------------------
Output of the above Script is below:

As per my understanding it has problem with below line becaserest everithing is getting printed,
call epmautomate rundatarule "HeadCount_DataRule" %MonthS%-%YearS% %MonthE%-%YearE% REPLACE STORE_DATA inbox/"abc.csv"
It is not taking value for the variable like %MonthS%-%YearS% and %MonthE%-%YearE%.
Kindly suggest the solution for the same.
Thanks in advance.