- Print
- PDF
How Do I Use JobInfos and Master JobInfos in Lasernet?
Lasernet includes a framework set up for scripting, which can allow you to manipulate data more than with the standard tools. One of the major parts of the scripting is JobInfos. If you have coded before, it is best to see JobInfos as variables; if you have not, then a JobInfo can be seen as a label for a value that can be retrieved or changed. The main reason to use a JobInfo is so that you can use data from the input file in our scripts.
To do this in a form, there is a JobInfo tool that allows you to set up a JobInfo in the same way you would set up a rearrange. You can then give a name to this JobInfo, which can then be used in a script to retrieve the information stored in the input file.

You can also combine JobInfos with patterns to extract an array of data from an input file. For example, if you are working with an invoice and the customer has ordered five items, then you could arrange a JobInfo that would take in the cost of each item. Then, you could work through the array and add up each item's value to get an overall total.
var month = job.getJobInfo("month",0):
JobInfos are very helpful but they will only hold their value for the lifespan of the Job, this means that if you are processing several sheets to be combined later, then JobInfo values will only exist for each individual sheet and the values will n. be combined.
masterJob.setJobInfo("masterMonth","June");
var month = masterJob.getJobInfo("masterMonth",0);
A Master JobInfo works very similarly to a standard JobInfo, but its value is more persistent, so a value can be held between sheets. For example, if you have an invoice, and the final page is generated separately, you may want to hold the total in a Master JobInfo so it will be accessible to the final page, which is generated later.