Python command: Traceability

The Traceability commands in Python allow you to retrieve, edit, update, delete, and insert traceability values in the database.

See Python commands for other commands you can use with GainSeeker.

Syntax

Example

Description/Remarks

traceability.deletevalue(traceindex, value)

traceability.deletevalue(6, "1234 JOE SMITH")

Deletes the specified value from the list for the specified traceability index.

Note: This does not affect existing data records stored in the GainSeeker database.

traceability.getlabel(traceindex)

trace6Label = traceability.getlabel(6)

trace6Label would contain "Operator"

Returns the label for the specified traceability index.

traceability.getprioritylist(traceindex)

inspect.cursubi.trace("SKUs").list = traceability.getprioritylist(6)

In an inspection, this changes the drop-down list for a traceability test with the Test ID "SKUs" to the priority list set up for traceability field 6 for the current GainSeeker user.

Returns the priority list for the specified traceability index that has been set up for the currently logged-in GainSeeker user.

If the user does not have a traceability priority list for that traceability index, or if that traceability index has not yet been set up in GainSeeker, this command returns a blank list.

If you specify a traceability index <1 or >48, this will cause an error.

traceability.gettablename(traceindex)

trace6TableName = traceability.gettablename(6)

trace6Label would contain "TRACE6_TOUR"

Returns the table name of the specified traceability index.

traceability.insertvalue(traceindex, value)

traceability.insertvalue(6, "1234 AMY SMITH")

Adds the specified value to the list of traceability value for the specified traceability index.

Note: Duplicate values are ignored.

traceability.isvisible(traceindex)

if traceability.isvisible(6):
    print "Operator is visible during data entry"

Returns True if the specified traceability index is visible during data entry.

traceability.resetalltracelists()

traceability.resetalltracelists()

Re-initialize all traceability lists to their values specified in the GainSeeker database.

This is useful for changing configurations and then setting all traceability lists in memory to the lists specified by the new configuration.

traceability.resettracelist(traceindex)

traceability.resettracelist(6)

Re-initialize a specified traceability list to its values specified in the GainSeeker database.

This is useful for changing configurations and then setting all traceability lists in memory to the lists specified by the new configuration.

traceability.tracelist(traceindex)

operatorNameList = traceability.tracelist(6)

Returns the list of all traceability values for the specified traceability index.

traceability.updatevalue(traceindex, oldvalue, newvalue)

traceability.updatevalue(6,"1234 JOE SMITH","1234 AMY SMITH")

Updates the oldvalue with a newvalue for the specified traceability index.

Note: This does not affect existing data records stored in the GainSeeker database.