I have some logic to extract some groups of lines of content in a text file. This is a repeat step until the line is not empty. So the first line we reach within the file (starting from the top) will be our line to begin our extraction. Then with the groups of texts extracted, I use the first line of the groups of texts to name the file name output, e.g. SOMESOMETEXT_REFERENCENO.txt. I have some JavaScript within the data mapper to give me the line and concatenate it with some other variable as above in a field as “FileName”.
I am looking for a way to pass this “FileName” field data mapper variable to the Workflow. I have looked around the forums, but seem to get anything that I can start with. I would like to avoid having to utilise the Workflow to achieve this if possible, but if I must then that would be a start.
You can do that by making use of the “Set Job and Variables” task (1). After selecting the variable (“Var/Info#”) you want to change, you can add the value of the record field “FileName” by right clicking on the “Value” property. After that choose the option: “Get Metadata Location” (2) to select the record field. Make sure that the “Execute Data Mapping” task (3) will be executed before the “Set Job and Variables” task.
@Marten,
I think that what he wants is the other way around. He wants to pass a variable back to the Workflow process.
If I am correct, then it is quite easy. You already have a field in your Datamapper. So in your Workflow, open the Execute Datamapping plugin and set the Output Type to Metadata or XML or JSON, which ever you feel familiar too.
Then simply extract the value from the field. In metadata, the field would be name something like this: _ vger_fld_<name of your field>
There are two different “metadata” systems in PlanetPress Connect & Workflow, and they don’t mesh very well.
If the final need is to create separate output documents and use a value from the data as part of the output filenames, then you need to use Job Preset to create the “Connect metadata” field, and an Output Preset to perform the Separation and use the metadata field as part of the name in the separation settings. This is all part of Connect and you don’t need to use any of the Workflow metadata plugins.
If you need the value in Workflow for other reasons, then you can check the “Metadata” (rather than “ID only” option) in the Execute Data Mapping task. That will expose all fields as “Workflow metadata”, and you can read that value into an Automation Variable using the “Set Job Infos…” task (Get Metadata Location).