Use Flow Variable

Hi, i use  a File reader node for read a file. now,  how can use  a flow variable for especified the file location? and how assigned to valid Url?

 

Sorry, my english is poor.

 

thanks-.

Hi,

here is how to set the file URL through a Flow Variable:

1) Create a Flow Variable containing the URL for the file. There are multiple ways to do it depending on what you want to achieve with your workflow, but the easiest one to try out is to use the Table Creator node, name the first column "URL", set it to type String, then insert in the first row the path to the file you want to read, say "file:/C:/mydir/test.txt" if you are on Windows. [Note that the single / after file: is not a typo]. Next connect the Table Creator node to a Table Row to Variable node. Leave all settings to default. Execute the first two nodes to make sure everything is ok (semaphore on green).

2) Add a File Reader node, right click on it and choose Show Flow Variable Ports. Connect the Flow Variable output port (right red dot) of the Table Row to Variable node to the Flow Variable input port (red dot in the top-left corner) of the File Reader node.

3) Open the configuration of the File Reader node. Now the tricky part. In order for the configuration to be save properly, you first need to point the valid URL parameter to any text file on your drive. It doesn't have to be the one you indicated in your Flow Variable, any text file will do. This is needed because the File Reader node wants to scan the file in order to determine its structure and it cannot do it with a file linked to a Flow Variable. If you don't go through this step, you will not be able to save the configuration for the node. Once you have made the File Reader node happy with this "trick", you can proceed to actually linking the valid URL parameter to your Flow Variable (next step). Before proceeding, you may also want to adjust the other configuration parameters as needed.

4) Now it is time to link the Flow Variable to the valid URL parameter. In the configuration window of the File Reader node, click on the little button marked "v=?" which at this point should be red. A new window opens. Select the Use Variable option and choose "URL" from the drop-down next to it. Click Ok to confirm. Back to the configuration window, the little "v=?" button should now be green, indicating the valid URL parameter is now linked to the URL Flow Variable. At the bottom of the window you should see the sentence The "DataURL" parameter is controlled by a variable.

This is it. From now on the File Reader node will use the content of the Flow Variable as the URL of the file to read.

Hope this is clear enough, otherwise feel free to ask again.

Cheers,
Marco.

 

Is it me… and it will become more obvious with time? But I don’t always know I have the right flow variable… is there a tool to link the value we input in the config and which flow variable it is? Have you see the Salesforce.com tool that lets you set a hot key to display the API names of fields you have on screen? Something like that for flow variable would be awesome.

Feature Request.

Anyone have tips to help me get the right flow variable?