CSV lookup - Variable in CSV filename

Post Reply
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

CSV lookup - Variable in CSV filename

Post 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.
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Re: CSV lookup - Variable in CSV filename

Post 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.
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: CSV lookup - Variable in CSV filename

Post 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.
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Re: CSV lookup - Variable in CSV filename

Post 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"]
Arthur
Member
Posts: 113
Joined: Sat Sep 09, 2017 11:58 pm
Location: Yateley, UK

Re: CSV lookup - Variable in CSV filename

Post 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.
Post Reply