powered by CADENAS

Manual

Manual

5.8.2.1.15.16.  Reverse TypeCode Rule Editor
5.8.2.1.15.16.1. Purpose of Editor

In order to understand the purpose of the Reverse TypeCode Rule Editor let's have a look on search functionality in general.

Search functionality should also enable searching for Order number or Typecode. For parts without value range fields it's easy to index the needed values for each project line. In contrast, at parts with value range fields the Order number/Typecode changes with each change of a value range field (except functional characteristics, for example).

At catalogs with complex value ranges, where resolving would effect millions and billions of combinations, which exceed the limit set by config (see Section 3.2.16.2, “Limit resolving of value ranges (yellow fields) via config key ”), the search does not use the index. Instead the search term entered in PARTdataManager when searching for order number / type code is transferred to the script pnoreverse.vbb. The script calculates the single values of value range fields by using the regular expressions (generalized search pattern for character strings) contained in the configuration file pnoreverse.cfg.

Example project with a lot of value range variables which build up the part number / type code interactively

Example project with a lot of value range variables which build up the part number / type code interactively

The purpose of Reverse TypeCode Rule Editor (the term "Editor" will be used in the rest of this chapter) is to create the configuration file pnoreverse.cfg for catalog projects.

The Editor has several functionalities, which ease the creation. Under Section 5.8.2.1.15.16.4, “Dialog areas of Editor” the single functions are described.

The following section gives an overview on the complete process.

5.8.2.1.15.16.2. Complete process at a glance
Process
  • Resolve check, which already provides a listing of projects to be edited.

  • For the catalog level a pnoreverse.cfg is created with regular expressions, by which projects to be resolved are found (main config).

    Editing happens in a text editor (e.g. Notepad++).

  • On project level, for each project a project_name_pnoreverse.cfg is created, which contains regular expressions for the single variables which build up order number or type code.

    For this the Editor is used.

Which projects cannot be resolved regularly?

The answer is provided by the plugin Resolve check.

  1. On catalog level under Automation perform the command Resolve check.

    -> Among others, the analysis will provide detailed results about the number of projects which cannot be resolved.

    Following exemplary figure shows that 31 projects have value ranges (Amount complex projects) and 21 projects from this are over the limit, meaning are not resolvable. Amount projects with reverse is 0. That means presently there is no project with created pnoreverse.cfg. The percentage value of 67,74 % results from the ratio between Amount projects over limit and Amount complex projects.

    Exemplary result after processed resolve check

    Exemplary result after processed resolve check

    Details on resolve check can be found under Section 5.8.2.1.15.15, “Resolve check ”.

  2. Click on Yes.

    -> Excel/Notepad (depending on system settings) is opened. (Optionally, changes can be performed here. See Section 5.8.2.1.15.15, “Resolve check ”.)

    -> The dialog box Information is opened.

  3. Click on Yes.

    -> On catalog main level, a pnoreverse.cfg is created.

    [Note] Note

    On catalog main level, a pnoreverse.cfg is required. This config contains paths to all projects which have to be resolved specifically.

    (In the course of further editing each project gets a specific project_name_pnoreverse.cfg later. See below.)

    The automatically created pnoreverse.cfg has following structure:

    [PRJ_PATH]
    ABC=folder/project1.prj
    XYZ=folder/project2.prj

    The resolve check tries to calculate the value before "=". In simplest case all order numbers start with the same string like ABC or XYZ, for example, which however, is not always possible with complex cases. After the "=" the relative path to project is stated.

    The Resolve check provides valuable information.

    However, the automatically created pnoreverse.cfg is not usable in its original state, because

    • REGEX rules are missing, which are needed to find the project path

    • and furthermore, because projects have to be sorted by complexity of the unique substring of type code. (AKD-M0, for example should be before AKD.)

    However, the automatically created pnoreverse.cfg contains important information:

    • It gives an overview about all projects to be edited so that the scope of work can be estimated.

    • It shows the unique substring which leads to project (e.g. AKM1, AKM2, etc.).

    • The main config can be arranged before start of work on REGEX rules for projects.

    • At the end, it will reduce necessary time for creating the main config file.

    Example:

    Automatically created pnoreverse.cfg - REGEX rules are missing!

    Main config after processed resolve check

    Main config after processed resolve check

    Valid, manually created pnoreverse.cfg - REGEX rules available. On this please see below.

    Valid main config

    Valid main config

  4. Optionally: Call the Editor on catalog level in order to check if the list of projects to be resolved has been created.

    -> The Reverse Editor is opened with dialog box List of projects in main pnoreverse.cfg.

    Close the window by clicking on Cancel.

    -> Now you can see an empty main view of Editor.

    Close the Editor.

Creation of main config (pnoreverse.cfg on catalog level)

In Notepad++, create the needed regular expressions (REGEX), by which a certain string is filtered from order number or type code and the projects are found.

  1. Open the main config pnoreverse.cfg with Notepad++ (catalog level).

    (Directly from the opened Editor you can get this via Edit menu by clicking on Open main pnoreverse.cfg.)

  2. Based on the simple list from Resolve check, create the needed REGEX.

    List provided by Resolve check:

    [PRJ_PATH]
    ABC=folder/project1.prj
    XYZ=folder/project2.prj

    Example:

    • REGEX keys have to be incremented beginning with 0. REGEX0, REGEX1, REGEX2, etc.

      ^ means that following string has to be at the beginning.

      Parenthesis denotes the substring in focus.

      REGEX10=^(HD\d{2}B).*-

      Meaning of regular expression: At the beginning is "HD" followed by 2 numerical characters and a "B". This is the substring leading to the project. Any characters and a dash follow.

    • As second key the respective substring of type code / order number follows and as key value the project path. If there are multiple possible hits the path statement happens several times.

      HD24B=thomsonlinear\linear_actuators\electrakhd\electrakhd_asmtab.prj
      HD12B=thomsonlinear\linear_actuators\electrakhd\electrakhd_asmtab.prj

    Finished list of REGEX:

    #(HD12B)017-0100EXX1MMSF
    REGEX10=^(HD\d{2}B).*-
    HD24B=thomsonlinear\linear_actuators\electrakhd\electrakhd_asmtab.prj
    HD12B=thomsonlinear\linear_actuators\electrakhd\electrakhd_asmtab.prj
    
    #(MX12-)B8M05P0CC
    REGEX11=^(MX\d{2}-)
    MX24-=thomsonlinear\linear_actuators\max_jac\max_jac_asmtab.prj
    MX12-=thomsonlinear\linear_actuators\max_jac\max_jac_asmtab.prj
    
    #(W1202)-58A10XA1BD
    REGEX12(W\d{4})-
    W2404=thomsonlinear\linear_actuators\whispertrak\whispertrak_asmtab.prj
    W2402=thomsonlinear\linear_actuators\whispertrak\whispertrak_asmtab.prj
    W1204=thomsonlinear\linear_actuators\whispertrak\whispertrak_asmtab.prj
    W1202=thomsonlinear\linear_actuators\whispertrak\whispertrak_asmtab.prj

    [Note] Note

    The line marked with "#" is an exemplary type code (optional). The parenthesis denotes the substring leading to the correct project.

Creation of pnoreverse.cfg on project level
  1. Open Editor on catalog directory.

    -> Dialog box List of projects in main pnoreverse.cfg is opened.

    List of projects in main pnoreverse.cfg

    List of projects in main pnoreverse.cfg

  2. Perform a double-click on the project to be edited. In the following .../thomsonlinear/linear_actuators/electrakhd/electrakhd_asmtab.prj is used exemplarily.

    -> The Editor is opened.

    The Project path can be seen at the top.

    Project path

    Project path

    Important for the whole process following now is the PN variable.

    PN Variable

    PN Variable

    It shows the internal structure (Attribute algorithm) of order number or type code.

    [Note] Note
    • For all variables contained in the variable PN (PARTNUMBER) or affecting it[a], REGEX rules have to be specified.

    • Mostly variables contained in PN are value range variables, but not necessarily.

    • Fixed values like "-D" in above example don't have to be taken into the Editor.

    • The variable under PARTproject -> tabbed page General -> Variable with Type Code is automatically used with priority.

      Variable with order number and Variable with Type Code

      Variable with order number and Variable with Type Code

      If this is not set then Variable with order number is used, if this is not set as well then NB.

      However, any variable can be chosen manually and entirely free!

    [a] Possibly variables contain attribute algorithms again where not each variable used there is needed necessarily.

  3. Now fetch one variable after another into the Editor and create the correct REGEX.

    Fetch variable into Editor

    Fetch variable into Editor

    [Note] Note

    The expression enclosed with parenthesis is the focussed one.

    Parentheses denote the respective focus

    Parentheses denote the respective focus

    Example EMCSOPT:

    [EMCSOPT]
    #HD12B017-0100(EXX)1MMSF
    REGEX=HD.{2}.+-.{4}(.{3})
    

    Interpretation of REGEX: HD followed by 2 characters, followed by anything ending with -, followed by 4 characters, followed by 3 characters. The last expression is the one which provides the search string. In the sample string this is EXX.

    PN = '$MIVPN.$STDLC.$S.$EMCSOPT.$HOPT.$RAOPT.$FAOPT.$AORI.-D'

    In our example the PARTNUMBER depends on following variables:

    • MIVPN

    • STDLC

    • EMCSOPT

    • HOPT

    • RAOPT

    • FAOPT

    • AORI

    1. In the dialog box Variable table, select the variable which you want to fetch into the Editor. For example STDLC. See Fig. „Fetch variable into Editor“.

    2. Click on Select variable.

      -> The variable is loaded in Editor, in the dialog area Variable.

    3. Adjust the settings.

      [Note] Note

      Regex token:

      • The option dot "." should be preferably avoided. Instead, select tokens which limit the number of characters as good as possible.

        Dot is actually only needed if special characters except underscore ( _ ) shall be found.

      • If a variable only exists of numerical characters:

        -> Orderno=104578 -> \d is most suitable (=all numerical characters [0-9])

      • If a variable only exists of alphabetical characters:

        -> Thread=Left -> \w is most suitable (=all alphabetical, numerical characters and underscore)

      • If a variable exists of a mixture of alphabetical and numerical characters:

        -> ARTNR=AB123 -> \w is most suitable (=all alphabetical, numerical characters and underscore)

      • If all values of the variable have something in common:

        -> ARTNR: AB123 AB124 AB125 -> it makes sense to enter "AB" as fixed character.

    4. Click on the button >>> Add/Update selected variable to editor.

      -> The regular expression is created based on the settings in the dialog area Variable.

    5. If necessary perform manual changes in the Editor.

    6. Test the REGEX:

      1. Under Variable added, select the variable to be tested.

      2. Click on Get test regex.

        -> The expression is transferred into the Regex Tester.

      3. Click on GO.

        -> The result is displayed.

        Regex:  HD.{2}(.+-)
        Sample:  HD12B017-0100EXX1MMSF
        Match: HD12B017-
        ----------------------
        Group 1:   B017- -> (.+-)

        Interpretation:

        Regex "HD.{2}(.+-)" finds Match "HD12B017-". in Sample "HD12B017-0100EXX1MMSF"

        Now the parentheses come into play. They denote the searched part of expression.

        Group shows the result of the bracketed expression. Before -> the result is shown. After -> the search expression is shown.

        So (.+-) finds B017-.

        If multiple parenthesis had been used divers groups will appear. Different colors clarify the groups.

        If nothing is found 'No match' appears.

    7. Save the configuration via File menu -> Save.

      [Note] Note

      Accept Editor Changes only saves in clipboard. On this see Section 5.8.2.1.15.16.4.5, “Editor” -> point 11.

  4. Perform the process for all needed variables.

    Special case is variable mapping: If the substring used in Typecode is not identical with the value in the characteristic attribute table, a variable mapping has to be made. Details on this can be found under Section 5.8.2.1.15.16.6, “Variable mapping”.

    [Note] Note

    Exception: For variables with Status "Value range variable with naming" this is not necessary nevertheless, because the original value under Equation matches the substring in type code. Here in example B017-.

    In this example, for the variable MIV, a Mapping has to be made in addition. Reason for this is that the substring used in Typecode is not identical with the value in the characteristic attribute table.

    1. Open the dialog box Variable mapping with a click on the button Mapping.

    2. Enter the mapping and confirm with Save.

      -> The mapping is shown in the Editor below REGEX.

      [MIV]
      #(HD12)B017-0100EXX1MMSF
      REGEX=(HD.{2})
      HD12=HD12 = Electrak HD, 12 Vdc
      HD24=HD24 = Electrak HD, 24 Vdc
      

  5. In the described manner, edit all projects.

5.8.2.1.15.16.3. Start Editor

In order to start the Editor make sure that the files reverseeditor.vbb and its belonging reverseeditor.cfg are in the folder $CADENAS\libs\all\plugins.

If these files are available the Editor can be started as plugin inside PARTproject.

The user can start the Editor in the index tree via context menu command under Automation -> Reverse typecode search editor on different levels.

  • 23d-libs folder

  • Catalog folder

  • Project

Example: Start on project level

Example: Start on project level

5.8.2.1.15.16.3.1. Start Editor on "23d-libs" folder

If the user starts the Editor on 23d-libs folder, the dialog box Catalog list is opened.

Dialog box "Catalog list"

Dialog box "Catalog list"

1Catalog name column – The catalog name from 23d-libs is displayed. By clicking on the column name, the catalogs can be sorted alphabetically.

2Config exists column – YES if main config exists for this catalog, NO if main config doesn’t exist.

3File locked column – YES if main config file is read-only, NO if main config file is writable

4Config path column – if main config file exists its path is visible there

5Open selected button - After catalog selection and click on the button Open selected a dialog with a list of all projects having a pnoreverse.cfg file is displayed. To get this dialog you can just as well double-click on the catalog name. The dialog is described under Section 5.8.2.1.15.16.3.2, “Start editor on catalog folder” .

5.8.2.1.15.16.3.2. Start editor on catalog folder

If you start the Editor on catalog folder, you will get the dialog box List of projects in main pnoreverse.cfg.

In this window you can see a list of those projects which have been added in the main config of respective catalog.

1Project name – name of catalog project

2Config exists – YES if pnoreverse.cfg for this project exists. NO if no pnoreverse.cfg exists for the respective project.

3File locked - YES if pnoreverse.cfg for this project is read-only. NO if it is writable.

4Project path – Absolute path to catalog project.

5Open selected - Once user selected project and clicked on Open selected, the Editor is opened with loaded configuration file for selected project. To get this window user can also double-click on project name. Editor with loaded configuration file is visible in next section.

5.8.2.1.15.16.3.3. Start editor on project

If user starts Editor directly on project, Editor will open with loaded configuration file for this project.

5.8.2.1.15.16.3.4. Files/folder created with plugin

After user started plugin for the first time, under $CADENAS_USER, a folder called reverseeditor gets created.

Inside that folder there is a folder configuration with the configuration files reverseeditor.cfg and vartypes.cfg.

vartypes.cfg – contains variable types that are commonly used for creating pnoreverse.cfg configuration files. This list can be modified through the Editor.

reverseeditor.cfg – is used to record history of last opened projects, font styles/sizes and path to the notepad.

5.8.2.1.15.16.4. Dialog areas of Editor

In this chapter the single dialog areas of the Editor will be explained.

5.8.2.1.15.16.4.1. Variable table

After a project is opened, the dialog area Variable table with all project variables will be loaded. The user can see Name, Status and Format of the variable.

Functions in dialog area Variable table:

  1. When clicking into the column header under Name, the variables are sorted by name.

  2. After variable selection this can be transferred to the Editor dialog area by clicking on Select variable Button. The same could be achieved by double-clicking on the variable as well.

Besides variable name, in Variables table dialog, you can also check:

  1. Variable format – provided in the column Format:

    • A10: Text string with a length of 10 characters; (valid for data type TEXT)

    • F5.3: Number with 5 pre-decimal places and 3 post-decimal places (valid for data type REAL.)

    • I5: Integer with max. 5 places (valid for data type INTEGER)

  2. Variable status – provided in the column Status:

    • FIX: Variable with fixed value

    • ALG: Attribute algorithm

    • RNG: Value range variable

    • SYS: PARTsolutions variables

5.8.2.1.15.16.4.2. Variable values

Once selecting a variable in the dialog area Variable table, the variable equation appears in the dialog area Variable value.

5.8.2.1.15.16.4.3.  TypeCode Tester

The TypeCode Tester does exactly the same like PARTdataManager.

This module is used for testing the project configuration file by finding typecode (or the list of typecodes) using the REGEX created inside the configuration file.

1 - If user wants to test only one typecode example -> enter that typecode inside this section and start test with the button Run.

2 - This button is used to start the test (in the case that you are testing only one typecode).

3 - Load list - This button is used to test a list of typecodes – you don’t have to start the test with any buttons, test will start automatically after the list file is selected.

4 - Stop - This button is used to terminate the testing of typecode list

5 - Generate list - This button is used to open the Test list creator

The Test list creator is used to generate a test list for the opened project.

For this the user has to select the proper variable for the typecode (Variable for PN) and a number of typecodes to be created (Number of PNs)

When clicking Create a list of typecodes is created based on randomly selected values of value range variables (yellow fields).

In above example the test list contains 100 different typecodes.

If the checkbox Open folder afterwards is activated, after generation of the test list the respective folder with the created list is opened.

During the process of generating the list, the user can click on Background run, in order to minimize the window and continue the process in the background.

The test list is in CSV format and can be opened in the text editor. Location is: $CADENAS_USER\reverseeditor\test_lists\catalogname\firstletterofprojectname\projectname.

The following figure shows an example of a test list.

6 - Display of total number of tested typecodes (test all), successful test (test ok) and failed tests (test not ok)

7 – Display of test results:

  • Tabbed page All: All results for all tested typecodes

  • Tabbed page Yes list: List of results which passed the test

  • Tabbed page No list: List of results which failed the test

8Clear results: Clear display area (see 7)

9Details checkbox: Check if you just want to test one typecode and to see the details. The activation has no effect when testing a whole list (Generate list).

10Export: Export of test results in a CSV file. Depending on the chosen option, all (All), only successful (Yes) or only failed TypeCodes (No) are exported.

5.8.2.1.15.16.4.4. "Info" Docking window

This module serves as debugging/logging window. The user can see different kind of messages there which can warn that something is wrong (cfg is read only) or inform about performed actions (e.g. variable deleted).

5.8.2.1.15.16.4.5. Editor

1Main window: In this area the content of configuration file pnoreverse.cfg is shown.

Ctrl + S is the shortcut to save content.

[Note] Note

To be able to edit the configuration file through editor, make sure that it is not read only.

1aVariable name

1b - Comment: Does not affect functionality or test results. It is only used to ease the process of creating regex.

[Note] Note

Use parentheses to define what is to be found with REGEX.

1cREGEX value: – This REGEX is used to find the value for the variable specified under 1a.

[Note] Note

Also here, use parenthesis in order to specify what you are searching for.

2"Project path" dialog area: Using the Browse button you can define the project for which you want to create/edit the configuration file. Pressing ENTER while focus is inside this text box will refresh whole editor.

3 - "PN variable" dialog area

3a – Select variable for typecode in the list field.

3bEquation of variable

Example:

PN = '$MIVPN.$STDLC.$S.$EMCSOPT.$HOPT.$RAOPT.$FAOPT.$AORI.-D'

[Note] Note

For all variables contained in the variable PN (PARTNUMBER) or affecting it REGEX rules have to be defined.

Mostly the variables contained in PN are value range variables, however, not necessarily.

Fixed values like "-D" in above example don't have to be transferred into the Editor.

4"Classification" dialog area: Display of project classification. Here you can check if the loaded project is classified under Edit project -> tabbed page General -> Variables -> Variable with Type Code.

5Sample of Type Code: Example depends on the variable selected under 3a. If selection under 3a is changed, the sample is automatically changed. Main purpose of sample is to generate sample for comment and automatic parentheses placement inside comment (compare 1b above).

6Regex: Shows all REGEX for each variable summarized into one REGEX value. When adding or updating variables added before an automated adjustment is performed here. No user interaction necessary.

7"File info" dialog area: Information on the status of configuration file: Configuration file writable (readwrite) or read-only or information when configuration file is not yet created.

8"Variable added" dialog area: Variable already added to the configuration file can be deleted here again.

  1. In the list field, select the variable to be deleted.

  2. Click on the button Delete variable.

9 – Display area where currently selected variable can be manually edited. In order to transfer changes, click on the button (9a).

10 - "Variable" -dialog area: Configuration and adding of variables to configuration file.

Select variable, variable type and length. Then click on the button >>> (10i) to add it.

  1. Name: Display of currently selected variables. The list field contains all variables contained in the project.

  2. Type: Variable type (the list field is filled with data from vartypes.cfg)

  3. Length: Variable length. Determine number of characters for variable. In case that variable can have different number of characters this is used to set minimum number of characters

  4. To: In case that variable can have different number of characters then it is used to set maximum number of characters

  5. Cmt. length: Number of character in sample

  6. Preview: Preview of REGEX for this variable based on 10b, 10c, 10d

  7. REGEX: Default and most common case is when only one REGEX is needed to find the variable and in that case the setting option in editor looks like:

    In configuration file, REGEX for this variable is displayed without its numeric value.

    You can have situation when you need more than one REGEX to find variable, like in this case:

    In that case all REGEX need to be incremented.

    In order to edit the desired REGEX, in the list field, select the respective value.

    If REGEX1 shall be edited, change the value in list field to 1. User can type the number or it can be adjusted using the up/down arrows.

  8. Mapping: When clicking on the button, the dialog box Variable mapping is opened, where the mapping of variable values can be entered. Details on this can be found under Section 5.8.2.1.15.16.6, “Variable mapping”.

  9. >>>: When clicking on the button, the variable is added to the configuration file.

11Accept Editor Changes - It is mandatory to click on this button if you have done any changes manually inside editor. Use it before adding new variables or using Undo Editor Changes or Redo Editor Changes.

[Note] Note

If you want to save the configuration, you have to click on Save in the File menu!

12Undo Editor Changes - Make sure that you clicked on Accept Editor Changes before. This is classic undo, which will revert last change you have done.

13Redo Editor Changes - Make sure that you clicked on Accept Editor Changes before. Use this button to cancel changes done by Undo Editor Changes.

14Finalize variables - Deletes all temporarily/ auxiliary/fixed values variables from editor, like this one:

WKHZ is not variable in this project. It is just fixed value “WKHZ” at the beginning of sample but it can be added to editor during the process of creating configuration file to make process easier.

5.8.2.1.15.16.4.6. Regex tester

The module Regex tester is designed based on webpage "regex101.com" as additional tool which will help making and testing REGEX.

First, buttons and features will be explained, and then usage of tool will be explained.

5.8.2.1.15.16.4.6.1. Module features

1 – Insert REGEX which you want to use for search

2 – Insert typecode which you want to find with REGEX from section 1.

3Get test regex: When clicking this button, the variable currently selected under Variable added is used.

"Variable added" dialog

"Variable added" dialog

-> The REGEX defined for this variable is transferred to field 1.

-> The sample under Sample is transferred to field 2.

4GO - Starts a REGEX test performing a search trying to find the sample value under 2 by using the expression under 1.

5Results of REGEX test: Meaning of displayed results will be explained in Section 5.8.2.1.15.16.4.6.2, “Module usage”.

6Clear results: Deletes results under 5 (the whole box).

7Always clear: If this checkbox is checked then test results from section 5 will be cleared every time you click on Get test regex.

5.8.2.1.15.16.4.6.2. Module usage
5.8.2.1.15.16.4.6.2.1. Test results

In this section the test results are explained:

Variable – Variable name which REGEX is tested

Regex – REGEX used in order to find the sample

Sample – Sample that is search with REGEX

Match – Result detected by REGEX. If nothing was found 'No match' appears.

If parentheses had been used in REGEX, the values inside the parentheses are searched and displayed in the test results as groups.

Parentheses do not affect the search results. They are used in order to detect what is found with a specific part of the REGEX.

Example 1: It shall be determined what is found by the first \w and the second \w.

Group 1, Group 2

Group 1, Group 2

The first \w finds b, the second \w finds c, which is displayed under Group 1 and Group 2. Different colors clarify the groups.

Example 2:

No match

No match

The expression \d{4} tries to find 4 numerical characters in a row. However, the example "aaa123bcd" only contains 3 numerical characters in a row.

5.8.2.1.15.16.4.6.2.2. Example of successful test

Test

Is it possible that TypeCode 'aaa123bcd' is found with REGEX '\w{3}\d{3}(\w)(\w)(\w)'? (The focus is on the expression inside parenthesis.)

\w{3} represents the first block of 3 alphabetical characters. With this 'aaa' can be found.

\d{3} represents a block of 3 numerical characters. With this '123' can be found.

The letters b, c, d can be found with \w{3}, however, alternatively they can be search separately. If you suppose that they are values of different variables, they should be searched with three times \w.

5.8.2.1.15.16.4.6.2.3. Example of unsuccessful test

Test

Can TypeCode 'aaa123bcd' be found with REGEX '\w{4}\d{3}(\w)(\w)(\w)'?

\w{4} is a REGEX for a block of 4 alphabetical characters and is placed at the beginning of the expression. However, in this example there is no block of this kind at the beginning and so the REGEX cannot find anything. There is no match and this is shown in the test result by 'No match'. -> The REGEX should be corrected!

5.8.2.1.15.16.4.6.2.4. Difference from website "regex101.com"

As stated in the beginning on chapter this Regex tester is developed based on regex101.com. However, there is one difference.

  • regex101.com

    https://regex101.com/

    https://regex101.com/

    The REGEX also finds partial matches. The 'aaa' at the beginning is ignored.

  • Regex tester

    Module "Regex tester"

    Module "Regex tester"

    The CADENAS Regex tester will not find anything, if the REGEX is not correct from the beginning, because when testing and adding new variables to the configuration file it is supposed that all variables created before are correct.

5.8.2.1.15.16.5. Menus

5.8.2.1.15.16.5.1. "File" menu

"File" menu

"File" menu

In the File menu you can find following options:

  • Save – Save current state of configuration file

  • Open – Open configuration file

  • Exit – Close Editor

Also, you can see the list of recently opened projects.

5.8.2.1.15.16.5.2. "Edit" menu

"Edit" menu

"Edit" menu

  • Paste PRJ path – If the path to project or the path to project configuration file is in clipboard, when clicking on the command the respective configuration is loaded in the Editor.

  • Open main pnoreverse.cfg – Main configuration file of catalog is opened (based on loaded project).

  • Copy path for main pnoreverse.cfg – Creation of data which define the project in the main config and copy into the clipboard. This data is needed in a first step. (After this in the single project-specific config files, the specification of variables is done.)

    Example

    Example

  • Open CFG in notepad – The configuration of project currently loaded in the Editor is opened in the set text editor (see "Settings" menu -> Config).

  • Refresh data – Refresh display in Editor - Use this function in case that the file has been modified outside the Editor (e.g. in Notepad++).

5.8.2.1.15.16.5.3. "Tool" menu

"Tool" menu

"Tool" menu

Details on the dialog box Test list generator can be found under Section 5.8.2.1.15.16.4.3, “ TypeCode Tester ”.

5.8.2.1.15.16.5.3.1. Typecode iterator

Basically, the Typecode iterator is a kind of Test list generator. Unlike as the Test list generator, which will create typecode lists by randomly selecting variables and its values, the Typecode iterator will iterate only through selected variables and it will create typecodes with all of the possible values for each selected variable.

The Test list generator is more useful during the process of creating REGEX rules, but the Typecode iterator is more accurate in terms of checking REGEX rules for variables and in the end – for better QA.

1Variable for PN: Selection of Typecode variable

2 – Click on ... opens a list of value range variables (yellow fields) for the selected project. There user can select variables through which he wants to iterate and which will be included inside list of type codes.

3Max Number of Values per ValueRange - If the variable is a value range, user can select maximum number of values for this value range.

4 – Estimated number of typecodes which will be generated with iterator.

5.8.2.1.15.16.5.3.2. Multithread tester

The Multithread tester is an advanced version of the TypeCode tester, described under Section 5.8.2.1.15.16.4.3, “ TypeCode Tester ”.

1 – If only one typecode sample shall be tested, enter the typecode and start test via Run button or press Enter.

2Run - Start test (if only one typecode is tested)

3load list - Test of typecode list – You don't have to do anything. The test will automatically start after the list is loaded.

4Stop - When clicking the button testing of the typecode list can be terminated.

5Reset list - Retest of latest loaded list.

6Create NOT list - Creation of a test list consisting of only those typecodes which didn’t past the test from latest tested test list. This new test list will be located in same folder with this latest tested list.

7&10c – Please regard that this option can only be used when testing a test list which has been created with the Typecode iterator. Once a list is finished each typecode of the list can individually be tested. Just copy typecode into the input field 1 and click on Get mident. The Mident for this typecode is displayed in 10c and a new button Show part appears. When clicking on this button and PARTdataManager is opened, the part is opened there. The button Show part will also appear, when testing only one typecode and the test is OK.

Show part - Mident

Show part - Mident

8 - detailed results - Check the checkbox when testing only one typecode and want to see test details like "which value is found with which REGEX rule", "is typecode connected with proper configuration file", etc. When testing a whole list this option doesn't take effect.

9AdvNot - If the checkbox is checked, typecodes which failed the test will be displayed in NO list below typecode you are looking for.

10 – Tabbed page All: Display of all results of all tested typecodes.

10a - Tabbed page Yes list: Display of all typecodes which passed the test

10b - Tabbed page No list: Display of all typecodes which failed the test.

10c – Described under 7.

11Threads - Number of logical processors of PC, which will be used for testing. The more logical processors, the less time exposure for complete testing of test list.

12Threads checkbox - If activated typecode pasted with Paste (13) is automatically tested (like with click on Run).

13Paste - Usual paste functionality, but it is practical if you use it with checkbox 12 checked. After click on Paste pasted typecode is automatically tested.

14 – Input field for catalog name, if only one typecode is tested. When testing a whole list, nothing has to be inserted here.

5.8.2.1.15.16.5.4. "Settings" menu

"Settings" menu

"Settings" menu

  • Regex tokens – The dialog box Edit regex tokens is opened - Here you can add, edit, delete single REGEX tokens. They are stored under vartypes.cfg.

    Edit regex tokens

    Edit regex tokens

    New (Add new) –> – Fill out the fields Type, Description and Regex tokens and click on Apply.

    Edit (Edit existing) – Select row to be edited, click on Edit and finally confirm with Apply.

    Delete (Delete existing) – Select row to be edited and click on Delete.

  • Config – Here font style, and font size can be adjusted, furthermore the path to Notepad. All Changes will be done below $CADENAS_USER\reverseeditor\configuration in reverseeditor.cfg.

5.8.2.1.15.16.5.5. "View" menu

In this menu the visibility of the single menus can be controlled.

5.8.2.1.15.16.6. Variable mapping

If the substring of type code found by REGEX rule does not exactly match the variable value in the characteristic attribute table then these two values have to be mapped onto each other.

Mappings are stated in the dialog box Variable mapping. This is opened by clicking on the button Mapping.

5.8.2.1.15.16.6.1. Simple variable mapping

For simple variable mapping, in the REGEX, one parenthesis is used.

Example:

REGEX=(MS\d{2})L

Sample project: thomsonlinear/linear_motion_systems/ms/ms_asmtab.prj

We are looking for the variable TU inside the given typecode. The variable TU can have the values MS25 or MS33, but a look into the characteristic attribute table shows that there is not only MS25 displayed, but MS25 = MS25 unit. This means that when we found MS25 inside typecode for variable TU, we need to map MS25 to MS25 = MS25 unit (the visible value in the characteristic attribute table.

5.8.2.1.15.16.6.2. Multiple variable mapping

Multiple variable mapping is performed by using more than one parenthesis inside one REGEX.

Example:

REGEX3=.+(SAE)=(\d{1,2})-

Multiple variable mapping can be used because of two reasons:

Details on this can be found in the next two sections.

5.8.2.1.15.16.6.2.1. Reducing number of mapping combinations

Sample project: bimba/trd/trd_d1/cylinders/ms_parts/ms_asmtab.prj

To find the proper value of the variable PT, mapping is necessary.

You can see that REGEX3 and REGEX10 have similar rules for search. Only difference is that REGEX10 is intended to find typecodes with “#“ included.

The following figure shows mappings for REGEX3 and REGEX10. In both rules the first parenthesis shall find "SAE" (red part), the second parenthesis the numerical value (blue part).

We can use same mapping for both REGEX rules and this is achieved using multiple mapping. If single mapping is used there, we would still have two REGEX rules which will look like that:

REGEX3=.+(SAE=\d{1,2})-
REGEX10=.+(SAE=[#]\d{1,2})-

But in this case we need to have 6 mappings instead of 3.

SAE=4=0.4375
SAE=#4=0.4375
SAE=5=0.5
SAE=#5=0.5
SAE=6=0.5625
SAE=#6=0.5625

5.8.2.1.15.16.6.2.2. Detecting variable value through values of other variables

Sample project: bimba/trd/mh_tas/mh_parts/mh_asmtab.prj

In this project, the variable RE can have the values KK1, KK2, KK3, KK4.... Normally this value is visible in typecode, but there are some special cases when KK4 is not visible in typecode. In order to find this typecode anyhow, the presence of the value KK4 has to be detected by the use of other variables. In this example we are searching for the values of 4 other variables and then KK4 is triggered depending on the search results of that 4 variables.

First variable (MP1, MP2, MS2…) is MOUNT

Second variable (325,400,500..) is BORE

Third variable (100) is RS

Fourth variable (F,RE1000..) is REE

In this example we have following situation: If the variable MOUNT has the value MP1, MP2 or MS2, then KK4 is activated, but not visible in type code. However, there are further cases where the value of the variable RE is NOT KK4 although MOUNT is MP1, MP2 or MS2. So the rule has to be refined by the use of more variables.

Separator between variables is an empty space.

[Note] Note

If a variable value cannot be determined even then, this specific project is not completely suitable for the typecode search.

5.8.2.1.15.16.6.3. Mapping empty string

Sample project: bimba/trd/ss/parts/ss_ms_asmtab.prj

Mapping of an empty string is used, when the presence of a variable is not visible in typecode once specific values of this variable are selected.

In this case, we are looking for number near letter H. This number is value of variable CLH in most cases inside this project, except when there is no number near letter H. When there is no number near letter H value of variable CLH is 2. This is reason why we are mapping ‘nothing’ (empty string) with number 2.