Lab Logic Toolkit FAQ

What Java/Groovy methods can I use in a Lab Logic Toolkit (LLTK) Expression?

You can use all methods included in the Java and Groovy base packages.

Commonly used Java classes are:

  • String: http://docs.oracle.com/javase/8/docs/api/java/lang/String.html

  • Math: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html

For information on Groovy closures, see Groovy Closures.

How do I handle attempts to access custom fields that do not exist or do not have a value set?

Use the hasValue function to check for nonexistent fields and fields that do not have a value set - including toggle switches in LIMS v5 and later.

See Non-UDF Custom Field Properties.

How do I prevent a user from moving to the next screen if certain criteria are not met?

Use the hasValue function together with the fail() method to check for step UDF / custom field values when the Record Details screen is exited, and prevent the user from advancing to the next screen if they have not entered values for these fields.

See Failing a Script.

How do I control the number of decimal places for a custom field?

Use the following expression:

  1. Use Groovy syntax to format the following string:

    String.format(::%.0f::, step.::counter::)
  2. Replace step.::counter:: with the field you want to apply the formatting to.

  3. Replace %.0f with the number of decimal places needed. For example, for three decimal places, use %.3f.

Example:

String.format(::%.2f::, Concentration::).

How do I round to the closest integer below a value using Math.floor?

Use the following expression:

-exp 'output.::NTP Uses:: = Math.floor((input.::NTP Volume (uL):: - step.::NTP Dead Volume (uL)::)/ step.::NTP Volume Per Lane (uL)::)'

How do I use LLTK with required custom fields?

Custom fields are set as a bulk group in the API. The API checks all required fields.

When LLTK updates a field, all required fields must be set or an error will occur.

Workaround:

  1. Set the required fields with a value such "Please fill in this value".

  2. Use another LLTK expression triggered on step completion to check whether this value has been updated.

    • If the field value has been updated, allow the step to proceed.

    • If the field value has not been updated, log an error and halt progress of the step.

Last updated