Populate Filename With Editor Field Value

It is possible to configure your product so that the value of a field in the Catfish Editor carries through to the output filename. This can have many uses, such as making it easier to organise your files once you have downloaded them, or to allow you to more easily identify an output. This is accomplished by copying the value of the text field through to a product attribute during output creation.

To demonstrate this, I have created a simple PDF which contains a single text field called "OperatorNameField" as well as a product attribute called "OperatorNameAttribute".

Attribute_Name.png

Field_Name.png

As the product attribute is only being used to 'carry' the field value to the output, the user will not need to see this on the landing page. Because of this, I have set the control type of this attribute to Hidden as shown below.

Attribute_configuration.png

After creating a product with this configuration, you will need to configure the file output name so that there is a placeholder for the attribute you have just assigned to the product.

The file output name can be edited by navigating to Admin -> Catfish -> Infigo Variable Data -> Infigo Settings and configuring the OutputFileNameTemplate field. However, in order to use the template configuration, you will need to enable the setting UseOutputFileNameTemplate by checking the box highlighted in red below:

Filename_config.png

As you will be able to see in the field highlighted above in blue, the field is already populated with the template:

%TypeLetter%_%OrderID%_%JobID%_%Username%_%ProductName%_%Quantity%_%OrderItemsNbr%-%OrderItemsSetSize%_%Date%_%Time%.pdf

This is the default configuration, and anything which is surrounded by two % signs is a variable which can be found in the XML and Prepare String Data of the Infigo Settings page. However, it is possible to add product attributes as a template, by simply adding AttributeCFPARAMETERAttributeName. The "CFPARAMETER" is there to act in place of : as this character is not accepted in a filename.

For this configuration, I will be adding _%AttributeCFPARAMETEROperatorNameAttribute% to the end of the filename. The _ is not necessary, but it looks more appealing and allows us to more easily distinguish one attribute from another. My file name template is now the following:

%TypeLetter%_%OrderID%_%JobID%_%Username%_%ProductName%_%Quantity%_%OrderItemsNbr%-%OrderItemsSetSize%_%Date%_%Time%_%AttributeCFPARAMETEROperatorNameAttribute%.pdf

Now that the filename and product has been configured, the field name will need to be mapped to the attribute in order for the value to copy through to the filename. 

To do this, you will need to use the field VariableItemProductAttributeMapping which is located still on the Infigo Settings page. 

The mapping follows the template FieldName=AttributeName. See below for an example on how this would be done for the product used in this example:

Mapping_config.png

Now that the output template has been configured, and the variable has been mapped, all that's left is to place a test order to ensure that the product is set up correctly.

As you can see in the screenshots below:

There is no visible attribute on the landing page

Landing_page.png

I have entered "John Doe" into the field OperatorNameField

Editor.png

"John Doe" appears in the filename

Output_filename.png

I have attached the PDF I used in the creation of this article to allow you to follow these steps exactly when first trying to configure your storefront to recreate this behaviour.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk