Read file path from a csv file(key-value pair) to context variable

Four Stars

Read file path from a csv file(key-value pair) to context variable

Hi Forum,
How can I dynamically read file path to context variables ?
My job design is as follows 
CSV file -> Context Load -> LogRow
context variable created for file path is : file_to_path 
CSV file is located at : C:\Users\sadakar.pochampalli\Downloads\context.csv
My goal is to load the database connections defined in CSV file as context variables so that I can make the job dynamic. 
( I used TOS 4 years back for few months only and now would be working on a project) - I have found few articles but it doesn't have relative path reading )
Thank you in advance for any inputs. 
Regards,
Sadakar Pochampalli 
Six Stars JR
Six Stars

Re: Read file path from a csv file(key-value pair) to context variable

I am not sure if I understand your problem. Do you want to have a relative file path in a context variable (like "../../context.csv")? If yes, this will be difficult to achieve as the job could be placed and started from anywhere on your file system. I have always only worked with absolute paths for which I also created context variables (in your case "C:/Users/sadakar.pochampalli/Downloads/").
Twelve Stars

Re: Read file path from a csv file(key-value pair) to context variable

Relative path like ./context.csv - work fine
for avoid problems with different locations, You can use next (I personally do this)
In each Job I import global context which include usually only few settings, like:
- context_file_path, and it different for different context groups
if for example DEV it is Studio - fixed path to context file on You developer machine
if it PROD - ./context.csv - it mean file locate in same folder with .sh/.bat file of Your Job
-----------