Guide contents

When implementing a custom module, you will notice that there are quite a few modules which accept a list of files as an input parameter usually with the name FileSource and might provide output of processed files as FileList or other parameter names. We refer to all of these type of parameters as FileLists as a general name. When used as an input parameter, the list of files can be supplied as a simple list of files including their fully qualified paths as shown in this example.

C:\MyApplicationData\Incoming\Orders_2021-01-22_09-12-32.json¶
C:\MyApplicationData\Incoming\Orders_2021-01-22_09-46-01.json¶
C:\MyApplicationData\Incoming\Orders_2021-01-22_10-33-18.json¶
C:\MyApplicationData\Incoming\Orders_2021-01-22_11-01-46.json¶

This would be accepted as a valid list of files that the module can process. However, if you look at the output from many of the included modules which show a list of files, and most significantly the FileList output parameter from the [Files] Find module, you will notice the data looks a little different from this simple list format. Internally all the included modules support a more robust structured definition of this kind of data. This structured data format allows certain modules to have additional functionality. This type of structured data is known as a FileGroup. This structured data utilizes the industry standard JSON format. The standardized JSON data has the benefit of being human legible and describes itself while being widely supported by a variety of other data tools when needed. As an example, if the above list of files had come as a result of output from a [Files] Find module, the data would instead look like this example.

{
   "$schema": "LocalFileGroups",
   "$version": "1.0",
   "BasePath": "C:\MyApplicationData",
   "Groups":[
      {
         "Path":"C:\MyApplicationData\Incoming",
         "Files":[
			{
				"Name": "Orders_2021-01-22_09-12-32.json"
			},
			{
				"Name": "Orders_2021-01-22_09-46-01.json"
			},
            {
				"Name": "Orders_2021-01-22_10-33-18.json"
			},
            {
				"Name": "Orders_2021-01-22_11-01-46.json"
			}
         ]
      },
   ]
}

In this example, you can see the folder structure and list of the files contained within them. Note that this example JSON text is formatted for legibility and normal data exchanged between modules will usually always use the minified version of this data. In this example, the data is telling us the find module started looking for files in the folder shown for the BasePath in the top level of this data. This is usually not relevant for many modules that just process individual files, but it has benefits for modules that have options for working with the hierarchy of folders and the set of files contained within it. You can find out more detail about how this can be used in a knowledgebase article linked below.

Next of note in the JSON data we see that there can be an array of Groups. Each group will have its own Path value and then will have an array of files that are associated with it. The number of files is not limited and can continue for as long as needed. We recommend using the same FileGroup structure for supporting lists of files and of course you will need to if you want to use the output of the included modules in your own custom modules. More details about the FileGroup structure and how it is beneficial to various use cases can be found at the following article for developers who may be consuming or generating this data in your own modules.

https://kb.jobserver.net/Q100038

An unhandled error has occurred. Reload 🗙