Skip to main content
Waters

How to restrict input to an OALogin input field to restrict file name length or prevent use of illegal characters - WKB28758

Article number: 28758

OBJECTIVE or GOAL

Prevent analysts from using too many characters or using characters that are not allowed in an OALogin input field (e.g. SampleID) that will be used as MassLynx file names.
Only allow permitted file name formats and file name lengths.
This follows the format of Regular Expression or RegEx.

ENVIRONMENT

  • MassLynx
  • OALogin

PROCEDURE

  1. In the OpenLynx Method editor, go to:
    Setup > Walk Up > Input Fields
  2. Select Edit Fields.
  3. Click SampleID, and then select Edit Formats.
  4. If there are any formats in the Available Formats field, delete them.
  5. In the New Format box, type the following text:
    [^$. %|?!"£*^@#-)(+=<>:]*
  6. Click Add.
  7. Click OK.

This now prohibits the use of any of the following characters in the SampleID field:  
$. %|?!"£*^@#-)(+=<>:
Note: It is not possible to restrict the use of the backslash \ character.

8.  To restrict the length of the file name, add the following text to the start of the formatting text:
     (?=.{5,32}$)
     where the name must be at least 5 characters long but no longer than 32 characters
     Giving a full string as:   (?=.{5,32}$)[^$. %|?!"£*^@#-)(+=<>:]*

NOTE: To apply the same field entries to all OpenLynx/ OALogin methods e.g. to ensure that all methods force a character limit:

  1. Make a base method with only the fields required for restriction. e.g. Sample ID and Sample Name
  2. Set the formats in the method as above
  3. Save the method with a suitable name e.g. validation method
  4. In OALogin > Admin > Validation Options... select this new method to restrict field inputs in all samples logged in via OALogin

ADDITIONAL INFORMATION

See also article Which characters cannot be used in file names in MassLynx?

From MassLynx help:
Defining the format for fields that remote users complete

You can define the format for numeric and text fields that appear in the Login window when remote users log samples. The fields can be designated as mandatory or optional. This feature enables you to use regular expressions to define the format. Regular expressions are like wildcards you use to define acceptable entries. The text entered by remote users must conform to these wildcards. To learn more about regular expressions, visit http://regular-expressions.info/.

Tip: If the regular expressions you define apply to several fields, you can define the regular expressions in a text file (*.txt). Then you can import the text file for use with fields you select.

Regular expression syntax:
 

Syntax

Description

Character

Any character except [\^$.|?*+()

\ (backslash) followed by any of [\^$.|?*+()

Character class

[]

Any character except ^-]\ add that character to the possible matches for the character class.

\ (backslash) followed by any of ^-]\

- (hyphen) except immediately after the opening [

^ (caret) immediately after the opening [

\d, w\ and \s

Dot

. (dot)

Anchors

^ (caret)

$ (dollar)

Alternation

| (pipe)

Quantifiers

?

??

*

*?

+

 

To define the field formats:

  1. From the Walk-up tab, click Edit Fields.

  2. Click the field you want to add in the Available Fields list, and then click either Append to add the field to the end of the list or Insert to add it immediately before the field highlighted in the Order of Fields to Use list.

  3. Click the field for which you want to define field formats in the Order of Fields to Use list.

  1. Click Edit Formats.

  2. Define your formats as follows:

  • To create a new format, type the regular expression in the New Format text field, and then click Add.

  • To delete an existing format, click it, and then click Delete.

  • To import formats defined in a text file (*.txt), click Import, browse to find text file, click Open, and then click OK.

Tip: If other formats already exist for the field, you can overwrite them, or add the formats defined in the text file to them.

  1. To test whether a regular expression is acceptable, enter the text in the text box, and then click Test.

  2. Click OK.

 

id28758, MLYNX, MLYNXV41, SUPMM

Not able to find a solution? Click here to request help.