Array construction with empty value
Posted: 18 Sep 2021 08:04
Hi Folks -
This may be a stupid question. I have the following array:
There may be a time where the 4th position (i.e. REPLACE) does not require a value and therefore must remain empty. Naturally, batch does not know how to read that empty index and then shift everything to the left one after the empty. Is there a way to force the construction of my array to account for the empty index?
My hope is to still have "STORE_DATA" be available in !STR[%%A].EXP! when !STR[%%A].IMP! is empty.
Thank you!
This may be a stupid question. I have the following array:
Code: Select all
FOR %%a IN (
"FDR|DLR_DATA_FDRII,DLR_DATA_FDRII|inbox/LOC_DATA_FDRII|REPLACE|STORE_DATA"
) DO FOR /F "tokens=1-4 delims=|" %%A IN (%%a) DO (
SET "STR[%%A].DLR=%%B"
SET "STR[%%A].LOC=%%C"
SET "STR[%%A].IMP=%%D"
SET "STR[%%A].EXP=%%E"
)
Code: Select all
FOR %%a IN (
"FDR|DLR_DATA_FDRII,DLR_DATA_FDRII|inbox/LOC_DATA_FDRII||STORE_DATA""
) DO FOR /F "tokens=1-4 delims=|" %%A IN (%%a) DO (
SET "STR[%%A].DLR=%%B"
SET "STR[%%A].LOC=%%C"
SET "STR[%%A].IMP=%%D"
SET "STR[%%A].EXP=%%E"
)
Thank you!