PDF Creator - Using Dynamic tables

Now that you have seen how to use a PDF creator with the text variables and the image variables in a standard table you might have noted a few constraints in the use of the standard tables when using the list controls where you can have multiple selections of data. Standard tables do not exhibit the property to add more rows dynamically as per the data selected.

Studio provides the dynamic tables feature that enables the addition of multiple rows at run time. The Dynamic tables are easily customizable and allow you to add multi-select data using the List Variables. The dynamic tables provide the details for such list variables as multiple rows, the tables are basically created dynamically as per your list inputs.

Now let us consider a simple scenario to create a booking system for books at a library

Let us add the template first. Under Studio Console, click PDF Creator and click + (Add) template and click Blank template. Enter the name for your custom template and click Add Template.

If you have selected a ready template you would find that there are different components like text, titles, tables, images and variables already added to the template. You can customize these if you want as per your application.

If you have added a blank template, you would simply get a blank page. You can add the different containers and components to organize your page.

Adding components

To start with, note that the template page has a single + (Add) button at the bottom of the page that allows you to add a new page. Within this page you can add the other components like Title, Text, Heading 1, Heading 2, Table and so on. You can use these to design your page as needed. From the list of components add a Dynamic Table and a text control.

Adding variables

Now when you are designing a template, the main consideration is to use the template with your applications. You would typically need data from the Form or screen or even from the sheets. To be able to fetch the data and add it to your template, you need to use the variables. In this example let us see how to use the list variables.

To add variables to the template as required, under Variables, click the Add button which gives you the option to choose a text variable, photo variable, summary variables, list variable(text) and list variable (image). You can use these variables in the template by simply adding double curly brackets and adding the variable from the list. Click List variables (text) and add the necessary variables. We have added AuthorName, Type, Category as List Variables (text) type. Now add another List variable(image) for the Logo_Book. Let us also add another Text variable for author name.

Now for this example, we want to generate a booking system for the library books. Multiple books can also be chosen. Once your template is ready you can save it. The template needs to be published before it can be used in your workflows. So, click Publish and add an appropriate release note.

Now let us have a look at the form. Add a dropdown list for Category. Add a Form Repeat control and add text control for Author name and Checkbox control for Book format. Add a File upload control for Book cover and add a submit button.

Now add a workflow that you would link to your screen and select the task Generate PDF and add a self-explanatory Task Name. Under Template to use, select your Template name. You can also set the custom name for the PDF generated and can also encrypt the PDF by using Set User Password. Toggle on to set the password.

It is now necessary to configure the variables by using the data option to fetch the appropriate values. In this example, we have bound all the list variables to the list controls.

Click Done and your task is ready. So here you would be passing the input control’s values to use when the PDF is generated. The list variables are linked to the controls from the Form repeat control. Also, we have linked the Author name to the list variable as well as the text variable. You can note the difference in the output.

Generate PDF

To use the PDF generated, you can use another task like an email task to send the PDF generated to the specified user as an attachment. Provide the task name and select the user to send an email. Enter the subject and email body. Now we want to add the file as an attachment. It can be accessed through the data option as the .PDFLINK, where the workflow name is the name of the Generate PDF task created earlier. Click Done. Now the workflow is ready.

Now, whenever you submit your form for booking the books at the library you can now see the PDF is created based on the template. It has all the list control values submitted from the form. You can see that there were multiple selections done in the form. As we added a dynamic table with list variables, the table has multiple rows created as per selection. The dynamic table and the list variables thus enable you to create dynamic reports depending upon the multiple values selected using the respective list controls. It is typically useful where you are using pricing tables, check out items, and so on.

You can thus use the PDF creator in this way to design your own report templates and use them as per your application demands.