How do you use a context variable in tSystem component?
I have two context variables which are assigned values:
context.oldFileName context.newFileName I want DOS to rename the old file name with the new file name.
I think my tSystem component Command should look something like this:
"cmd /c echo "+ context.oldFileName+ context.newFileName+" " or this:
cmd /c REN %oldFileName% %newFileName% When I run the Command "
cmd /c echo "+ context.oldFileName+ context.newFileName+" " The result is "nullnull"
How do I get the tSystem to know the values of context.oldFileName and context.newFileName?
tFileCopy would take a long time to run for large files.
It looks like my job is getting the values but its failing on the tSystem:
The system cannot find the file specified. tContextLoad_1 set key "newFileName" with value "#$%&-_+.txt"
tContextLoad_1 set key "newFileName" with value "BatchFile.bat"
tContextLoad_1 set key "newFileName" with value "testFile.txt"
.-----------+-------------+-----------+---------------.
| tLogRow_1 |
|=----------+-------------+-----------+--------------=|
|key2 |value2 |key |value |
|=----------+-------------+-----------+--------------=|
|newFileName|#$%&-_+.txt |oldFileName|!@#$%&()-_+.txt|
|newFileName|BatchFile.bat|oldFileName|BatchFile.bat |
|newFileName|testFile.txt |oldFileName|testFile.txt |
'-----------+-------------+-----------+---------------'
So are the values getting to tSystem now? Have you tried just echoing them? Is the path correct? Try just the "cd" command to check what path tSystem thinks it's in.
Not sure why it works, but it does!
I ended up putting Iterate from the tFileInputDelimited to the tSystem.
This is the tSystem command that worked for me:
"cmd /c ren \""+context.oldFileName+"\" \""+context.newFileName+"\""