2. Configuration file explained - grahamjevon/ReG GitHub Wiki

Download and save the configuration file

The configuration file must be saved in the same location as the ReG.py file.

Editing the configuration file

You can configure some values to make the program work for your particular needs. Here is a screenshot of a configuration file example (open in Notepad++).

Screenshot of configuration file in Notepad++

The following ten settings can be changed:

Hierarchy

In the above example, the hierarchy contains 5 levels (starting with "Fonds" and ending with "Item". The hierarchy in the downloadable configuration file contains 13 levels:

  • Fonds
  • Sub-fonds
  • Sub-sub-fonds
  • Sub-sub-sub-fonds
  • Series
  • Sub-series
  • Sub-sub-series
  • Sub-sub-sub-series
  • File
  • Item
  • Sub-item
  • Sub-sub-item
  • Sub-sub-sub-item

You can remove any of these hierarchy terms and you can add as many new terms as you wish.

If you want to alter the hierarchy, you just need to ensure the following:

  • The hierarchy is contained within square brackets.
  • You hierarchy is ordered with the highest level first and the lowest level last.
  • Each term must be surrounded by "inverted commas".
  • Each term must be separated by a comma.

Example:

["Collection", "Section", "Series", "File", "Item"]

If the configuration file is not present or the configured setting is blank, the hierarchy will default to the 13 levels listed above:

When you run the program, if the hierarchy column contains any data not found in the configured hierarchy list, you will be warned and given two options to proceed.

Encoding

The default encoding is utf-8-sig. In most instances, you should leave this unchanged.

ImportFilepath

This will tell the program where to find the file you want to import. For example, if your file is located on your desktop, you should enter something like: "C:/Users/gjevon/Desktop"

Note: it is important to use forward slashed rather than back slashes.

If the configuration file is not present or the setting is blank, the program will default to looking for the file in the same folder that the ReG program is saved.

ImportPathUsePrefix

This requires a "Yes" or "No" answer.

Selecting "Yes" will impact the import file path. It will use the prefix to find a folder within the specified file path that contains that prefix before it looks for the file to import.

Windows folders

If the entered prefix is EAP0001, it will look inside the import file path for a folder that begins EAP0001. It will then look inside that folder for the folder to upload.

ExcelWorksheet

If you import an Excel file that contains multiple worksheets, you must inform the program which worksheet you want to import.

Screenshot of Microsoft Excel worksheets

This configuration setting gives you the opportunity to specify the name of worksheet you want to import. This is useful if you will regularly use the program on the same worksheet name. When you run the program it will automatically import the specified worksheet.

If the worksheet name is likely to change, you can leave this setting blank. When you run the program on a spreadsheet with more than one worksheet, you will then be asked to specify the worksheet you want to import. You will also be asked to specify the name of the worksheet if the configured worksheet name is not present in the imported spreadsheet.

HierarchyColumnName

You should enter the name of the column that contains your hierarchy data. The program will read this column in order to generate the references.

When you run the program, if this column name is not present in the imported dataset, you will be asked to select a column within that dataset.

If the configuration file is not present or the setting is blank, the program use the default column name "Level".

RefGenColumnName

You should enter the name of the column where you want the reference numbers to be generated.

When you run the program:

  • If this column name is not present in the imported dataset, this column will be added to the dataset.
  • If this column is present, the data in this column will be overwritten. If this column contains any data, you will be warned before it overwrites any data.
  • If the configuration file is not present or the setting is blank, the program use the default column name "Reference".

OutputFormat

You can choose to export the transformed data set in one of three formats:

"csv" "xls" "xlsx" If the configuration file is not present or the setting is blank, the program will default to csv.

ExportFilepath

This will tell the program where to export the file(s) it generates. For example, if you want the new file to be saved on your desktop, you should enter something like: "C:/Users/gjevon/Desktop"

Note: it is important to use forward slashed rather than back slashes.

If the configuration file is not present or the setting is blank, the program default to exporting the file to the same folder that the ReG software is located.

ExportPathUsePrefix

This requires a "Yes" or "No" answer.

Selecting "Yes" will impact the export file path. It will use the prefix to find a folder that within the specified filepath that contains that prefix before it exports the file.