To declare vairables in config file, use it in run time code with extracted dynamic values

Hi All, Good afternoon.
I have use case i need to save the file names dynaically which includes different values from each variable, but problem is any change in naming convention i need to update the changes in different scenarios / sequences within the code. thats too cumbersome. so what would be the posssible solution to make it easy? or is it possible to implement in a way a change in the code at one place should replicate everywhere else? or is it possible to declare these variables in config , excel file, ? so that a changing the naming convention in excel should take care of the changes in code level?? Please help me on this.

in this use case file path is combination of different variables. and these variables will dynamically get different values in run time, so i guess storing as static text in assest wont help in this case.
I need someting like variables as to be updated in one place , that is path. it should be affecting the changes in entire scenarios accross the code where ever its printing. Hope this use case is understandable.

exaple file naming: string+ variable1+variable2+variable3.pdf

Hi @Siddarth_Nagarabenchi,

Your Naming Convention format could be stored in the asset if it’s gonna change from time to time, you can apply string manipulations to it later and use it as will.

Thanks

Hi Aditya, Thanks for your answer.

But in my use case file path is combination of different variables. and these variables will dynamically get different values in run time, so i guess storing as static text in assest wont help in this case.
I need someting like variables as to be updated in one place , that is path. it should be affecting the changes in entire scenarios accross the code where ever its printing. Hope you understood the use case.

exaple file naming: string+ variable1+variable2+variable3.pdf

and these string, variable1, variable2, variable3. They would be fetching some values from some applications or data source?

@Siddarth_Nagarabenchi

You can store it in config file…and use relace functions so that when something changes we can change on in config

For example say your file name is ABC_var1_var2_var3.pdf

Then in config store the value as ABC_<PH1>_<PH2>_<PH3>.pdf and let key be filename1

And in your code you can use like this

In_Config("filename1").ToString.Replace("<PH1>",var1). Replace("<PH2>",var2). Replace("<PH3>",var3)

Hope this helps

Cheers

1 Like

yes, they extract values from a table.

Hi @Siddarth_Nagarabenchi
Then you can easily store your desired format in config as @Anil_G suggested and later could use Replace function.

I thought even your format is gonna change time to time hence I said to store format in Assets.

Hope your automation works!

Thanks

1 Like

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