Time clock systems by TimeIPS
Call Now! 316-264-1600
Information
Sales
Support
Knowledge Base Search:  
Main Menu
· Home

· Table of Contents
· Article Index

· Downloads
· New Features
· FAQ
· News
· Web Links

  
TimeIPS Knowledge Base

Table of Contents: Article IndexPrintable Version

Applies to versions: 2.1



Import Preprocessors



Import Preprocessors provide a way to modify files before they are imported into TimeIPS.  This is helpful when the columns and/or data need to be rearranged, removed, split, combined or mapped before processing.

 


Using the left pane Main Menu » Administration, click on: System » Import Preprocessors

 

 

 

 

Add New Import Preprocessor


  • To Add a new Import Preprocessor, click the + (plus) sign next to "Add New Import Preprocessor."

  • Add a descriptive Name and click the Create button to save.

 

  • In the table below, click the + (plus) sign next to the new Import Preprocessor.

  • Optionally, add a Description of this preprocessor and/or its intended use.
  • Select the type of Import you need from the drop down list.
  • Templates:
    • The preprocessor uses a Twig template. The following example reads a file and reprocesses it into a WorkOrder Vertical format.
    • The first line simply outputs the header row.
    • The second line "for row in input_rows" starts a loop that will process all lines of the input file. The loop ends with "endfor" on the last line.
    • Between these, the lines that start with "{{-" will produce output that will be processed by the import.  To access original data from the input file, use the syntax row.column_name.  If there are spaces in the column names, replace them with underscores, i.e. "_" and lowercase everything.
    • Data can be processed using a pipe "|" to various Twig functions, including slice.
    • Logic can be used in the form of terinary operations, such as (row.active=="yes"?"1":"0") which looks at the active column on the row and will make the output 1 if it's "yes" and 0 otherwise.
    • Commas are needed between columns, but quotes are automatically added around the data

        Template Example:

        "Work Order Name","Short Name","Code","Active","Reorder Job Sequences","Job Sequence","Job Code"
        {% for row in input_rows %}
          {{- row.work_order_name }},
          {{- row.lcd_name }},
          {{- row.code }},
          {{- (row.active|lower=="l0002" or row.active == "1")?"1":"0" }},
          {{- row.reorder_job_sequences }},
          {{- row.job_sequence }},
          {{- row.job_code|slice(-2) }}
        {% endfor %}


        This import preprocessor does the following:

      • The import file has a column named "lcd_name" that we want to re-map into a column called "Short Name"
      • The import file sometimes contains text of "l0002" for Active.  This, or "1" are the only things that indicate the row is active.  Everything else is mapped to 0, indicating the row is not active.
      • The job code column contains additional text prior to the last two digits, that are the actual job code.  We strip off all but the right-most two characters of the job code.

  • Make sure your previous changes are saved by clicking the Save Row button.
  • Test Template: Upload a CSV file in your own format to get the generated CSV filed based on this template.

 

NOTE: Twig is a standard text processing system.


©2004-2023 TimeIPS, Inc. All Rights Reserved - TimeIPS and the TimeIPS logo are registered trademarks of TimeIPS, Inc.
"Intelligent Personnel System" "Run your Business. We'll watch the clock." are trademarks of TimeIPS, Inc.
TimeIPS is protected by one or more patents. Patent No. US 7,114.684 B2.