How to pass variable in Config file


How to pass variable i config file.

I need to pick excel from config file,and that excel file name have variable of today’s date.

I assume you want to open the file? If so you could Open file with the variable similar to below:

in_StrExcelFile (however you’ve passed in your config filename) + " "“format of how the date is shown”)

This will add the date to the end of the filename after a space, does this help?

(This assumes you are using ReFramework and have “InitAllSettings” set up to read your config file already?)

Tnk u Alex
My excel file format is something like this D:\folder \folder name - Date.Now.To string(“MM-dd-yyyy”)\filename.xlsx"

So this is part of your config file?

Yes nadim

So i tried to workaround this but really cant use a VB expression as it stores all the data as a String/Object as is rather than evaluating the expression and using the result which seems valid enough as we are just loading the config.

One workaround i can think of is, use a identifier say ‘currdate’ in your config path like
D:\folder\folderName-currdate\filename.xlsx’ and
in your assign where you are fetching the value you can replace that with the date like Config(“filepath”).ToString.Replace(‘currdate’,Now.Date.ToString(MM-dd-yyyy))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.