Page 1 of 1

CSV lookup - Variable in CSV filename

Posted: Wed Jul 11, 2018 4:44 pm
by Arthur
Hi all;
A quick question here, as I believe many of you are using CSV Lookup.
Is there a way of pointing to a file which name is a Variable ??
it is straightforward to point to a fixed file / location, but how about a variable in either a path or a filename ??
Anyone has got it sorted this way ??

Would appreciate any help.

Re: CSV lookup - Variable in CSV filename

Posted: Wed Jul 11, 2018 5:05 pm
by dkelly
For "CSV file" property choose "Define single text with variables" and then enter the variable you want to use for the CSV filename.

Re: CSV lookup - Variable in CSV filename

Posted: Wed Jul 11, 2018 5:15 pm
by Arthur
Well - this is what seemed obvious, but it did not work.
I had it like that:
C:\path\[Variable]_Instructions.csv

And it does not see the file.

--- edit ---
Maybe I was not clear enough. It does not see the file, as it is delivered dynamically, as the flow goes. So at the time I would like to save the flow, the CSV is not in there, so is strikes an error and the flow cannot be saved and run.
So I understand it as the file is not there, cause the variable is not present yet, so the link to the CSV is incorrect.

Re: CSV lookup - Variable in CSV filename

Posted: Thu Jul 12, 2018 12:07 am
by dkelly
Are you storing the value in private data, metadata?

private data would look something like:
[Job.PrivateData:Key="filename"]

and metadata:
[Metadata.Text:Path="/mydata/filename"]

Re: CSV lookup - Variable in CSV filename

Posted: Thu Jul 12, 2018 10:59 am
by Arthur
Morning Dwight;
Sorted. Silly me.
The issue was trivial - the path to the CSV needs to be defined with forward slashes, rather than the native MS Windows way with backslashes.

So instead of: C:\path\ bla bla bla
it goes: C:/path/[variable]whatever.csv

And then it allows for Variables in either the path or the filename.
Ehhhhh :roll:

Thanks.