Hi All, I want to add an field to the data in a datamapper not workflow. I want it to be populated for each record and but to have a value from the first record. Parameter best to do this, I tried but it started throwing out some strange errors when I changed data files. I also tired in a
in a postprocessor but doesn’t seem to update when actually creating the PDF’s through connect designer
The Runtime Parameter is exactly how to do this. You mentioned “strange errors”… could you expand on that?
Hi Phil, I’m adding a property entire data scope with a default value of data.extract(‘IMAGENAME’, 0);
I’m then setting a field based on it during an extraction step
Works until I change the data in the mapper and then it says “unable to create DefaultImage”
Well that’s not going to work: a property with the entire data scope is static, meaning you cannot assign a dynamic value to it.
I was referring to Runtime Parameters, which can be passed from Workflow, and which you can then access with the automation.parameters
object.
Got you, I’m not using Workflow in this project. Ill have a go at doing it with a pre-processor as seems the logical point or post processor
You won’t be able to use data.extract() in your pre-processor because the data has not been processed yet (and therefore, the DataMapper doesn’t know what data.extract() actually means).
So you will have to read your file like a text file and parse the value manually. The following code should help you get started:
var myFile = openTextReader(data.filename,"UTF-8");
// If the first line of your CSV doesn't contain column headers, comment out the next line
var myHeaders = myFile.readLine();
var myLine = myFile.readLine();
var fields = myLine.split(",");
data.properties.MyProp=fields[0] // specify the 0-based index of the field to extract
myFile.close();
Hope that helps.
Worked great, thanks Phil