Python command: Retrieval

The Retrieval commands in Python can be used for two separate functions:

After using either group of commands to build or specify the data set, you can then use the Python statistics commands to work with individual data values and GainSeeker statistics for the retrieved data, and you can analyze the data in GainSeeker charts, dashboards, and Dynamic Desktops.

 

Contents  [Hide]

 

Retrieve stored data

Note: The recommended method of setting options for a basic SPC or DMS retrieval is to use a Set Retrieval SPC or DMS action (rather than writing your own Python code - or using a Custom Code action - with the commands listed below). These recommended Set Retrieval actions are easier to use and help you to avoid coding errors.

 

There are 3 basic steps to retrieve data that is stored in GainSeeker:

    1. Specify the DMS or SPC standard - or the DMS process - that you want to analyze:

      • To retrieve DMS data, use the retrdms commands.

        • The minimum information needed to retrieve stored data is one DMS process (set by the retrdms.process command) or one DMS part number (set by the retrdms.partno command).

        • You are limited to one DMS process, one DMS part number, or one combination of DMS process and DMS part number (equivalent to one DMS standard) for the retrieval; see the Tip below to retrieve more than one.

          • If you specify a DMS process without a DMS part number, data will be retrieved for all part numbers on that process.

          • If you specify a DMS part number without a DMS process, data will be retrieved for that part number across all processes.

          • If you specify both a DMS part number and a DMS process, only the data with that combination of part number and process will be retrieved.

      • To retrieve SPC data, use the retrspc commands.

        • The minimum information needed to retrieve stored data is an SPC standard, set by the retrspc.partno command. You can only specify one SPC part number for the retrieval; see the Tip below to retrieve more than one.

        • As with other GainSeeker analysis tools, bypassed data is not included by default.

      • Tip: If you need to analyze multiple processes, part numbers, or standards (as well as multiple date periods and/or filters):

        1. Use these commands to retrieve data for the first combination of process / part number / standard, date period, and filter.

        2. Use the external data commands to add this retrieved data to an "external data" dataset.

        3. Set retrdms.useexternal = False (or retrspc.useexternal = False).

        4. Repeat the steps above for each additional combination of process / part number / standard, date period, and filter.

    1. (optional) Use commands in the table below to set other retrieval settings such as date period, filter, or SPC data count.

    2. Work with the retrieval you have specified above:

      • (optional) Verify that the retrieval you have specified is valid, using the retrdms.validretrieval or retrspc.validretrieval command.

      • Retrieve data and statistics for the retrieval, using the Python statistics commands.

      • (optional) Perform the data retrieval again, using the retrdms.refresh() or retrspc.refresh() command.

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

retrspc.count

retrspc.partno = 1000

Get/Set the maximum number of data points for retrieving SPC data stored in GainSeeker.

Does not apply to external data.

 

retrdms.filter

retrspc.filter

retrdms.filter = "Molding Dept"

 

retrspc.filter = "UDL3 = 'MOLDING'"

retrspc.filter = "UDL3 <> 'MOLDING'"

retrspc.filter = "UDL3 Not Like '%MOLDING%'

retrspc.filter = "(UDL7 <> 'MOLDING' Or UDL7 Is NULL)"

retrspc.filter = "(UDL7 Not Like '%MOLDING%' Or UDL7 Is NULL)"

 

retrspc.filter = UDL3 = 'MOLDING' and {}.PARTNO = '12-35001-Hold Time'".format(sql.tables.vdata)

Get/Set the filter for retrieving data stored in GainSeeker.:

  • You can specify a saved SPC or DMS filter using the filter name.

  • You can set a quick filter by using SQL query syntax.

  • For SQL queries on traceability fields 7 and higher, when querying for "not like" or "not equal", remember that you need to add "Or UDLx Is NULL" like the examples shown at left.

  • For SQL queries on the PARTNO or DATETIME, you need to qualify the table name for these columns like the example shown at left.

Does not apply to external data.

 

retrdms.partno

retrspc.partno

retrdms.partno = "B-75 INSERT"

retrspc.partno = "D-34KW Diameter Z"

Get/Set the part number for retrieving data stored in GainSeeker.

For a DMS retrieval:

  • If retrdms.partno is not set, all data for retrdms.process is retrieved.

  • If retrdms.process is not set, all data for retrdms.partno is retrieved.

Does not apply to external data.

8.9

retrdms.process

retrdms.process = "M-CUT OFF"

Get/Set the DMS process for retrieving data stored in GainSeeker.

If retrdms.partno is not set, all data for retrdms.process is retrieved.

If retrdms.process is not set, all data for retrdms.partno is retrieved.

Does not apply to external data.

8.9

retrdms.periodstr

retrspc.periodstr

retrdms.periodstr = '17'

Sets the date period for retrieval to 'One month ending today'.

 

retrspc.periodstr = '36'

Sets the date period for retrieval to 'One day ending now'.

Gets/Sets the date period for retrieving data stored in GainSeeker.

The default (None) is the configuration setting for the current user.

Other valid options include the numbers below, which must be specified as a string:

Today

1

Last n hours ending now

35

One day ending now

36

One week ending today

16

One month ending today

17

One quarter ending today

18

One year ending today

19

Default low to today

32

Current week

4

Current month

5

Current quarter

6

Current year

7

All dates

3

To specify a date period not on this list, use the Set Retrieval DMS or SPC actions to set the desired date period.

Does not apply to external data.

 

retrdms.refresh()

retrspc.refresh()

retrspc.refresh()

Force a new retrieval of stored GainSeeker data to get most recent data.

Does not apply to external data.

 

retrdms.setretropt(key, value)

retrspc.setretropt(key, value)

retrdms.setretropt("ParetoSort", 6)

Sets DMS Pareto analysis to sort Pareto bars by Traceability field #3.

 

retrdms.setretropt("OEEGroup", "0|-1")

Sets DMS OEE analysis to group OEE data by Day with no second level grouping.

 

retrspc.setretropt("Group", "udl3")

Sets SPC control analysis to group data by Traceability field #3.

Set other Retrieval/Configuration overrides. This is useful for Python dashboard retrievals where you cannot change individual chart settings on the fly.

Available options include:

  • DMS Pareto "Sort by" options

key = "ParetoSort"

value is always a number:

0 = Process

1 = Part Number

2 = Defect

3 = Event

4 = Traceability #1 through 51=Traceability #48

  • DMS DPU "Group by" options and DMS OEE "Group by" options

key = "DPUGroup" or key = "OEEGroup"

value is always a string in the format "#|#" where:

      • the first number (#) is the first-level grouping.

      • the second number (#) is the second-level grouping.
        To turn off second-level grouping, set this number to -1 .

Both numbers (#) can be one of the following:

0 = Day

1 = Week

2 = Month

3 = Quarter

4 = Hour

5 = Day/shift

6 = 5 minutes

7 = 10 minutes

8 = 15 minutes

9 = 20 minutes

10 = 30 minutes

1001 = Traceability #1 through 1048 = Traceability #48

Note: Some combinations do not apply and may cause unexpected results. Use the Chart Settings in the GainSeeker Charts module to verify that a combination will work properly.

  • SPC "Group by" options

key = "Group"

value can be either a number or a string:

0 (number) = None

1 (number) = Anchor Point

11 (number) = Year

12 (number) = Month

13 (number) = Day

14 (number) = Hour

20 (number) = Quarter

21 (number) = Week

"udl1" through "udl48" (string) = Traceability

The equivalent "Group By" setting in the GainSeeker Charts module is this traceability field with the "Sort by traceability field" check box selected.

"partno" (string) = SPC standard

9.1

retrdms.useexternal

retrspc.useexternal

if retrdms.useexternal == True:

   print "retrieving external data."

Gets/Sets whether the retrieval will be loaded with an external dataset or with data stored in GainSeeker.

If False (the default), the retrieval is loaded using data stored in GainSeeker.

If True, the retrieval is loaded using an external dataset. Executing retrdms.external.addrow() automatically sets retrdms.useexternal = True , and executing retrspc.external.addrow() automatically sets retrspc.useexternal = True

8.8

retrdms.validretrieval

retrspc.validretrieval

isvalid = retrdms.validretrieval

If True, the information required for a retrieval is present:

  • For stored DMS data (retrdms.useexternal = False), a DMS process must be specified with retrdms.process or a DMS part number must be specified with retrdms.partno

  • For stored SPC data (retrspc.useexternal = False), an SPC standard must be specified with retrspc.partno

  • For external DMS data, the only requirement is that  retrdms.useexternal = True

  • For external SPC data, the only requirement is that  retrspc.useexternal = True

This does not guarantee that data is returned.

8.9

Retrieve external data

For information on launching scripted external data analysis in the GainSeeker Charts module, see Charting External Data

For information on using a Python script to create a dataset for dashboard analysis, see Retrievals for dashboard controls.


There are a few basic steps to writing a Python script that builds a dataset for GainSeeker analysis as external data:

    1. In your Python script, use standard Python commands to connect to your external data source and extract the data to analyze in GainSeeker.

      • While looping through the data in your external data source, use the GainSeeker Python commands below to translate that data into discrete GainSeeker data records. After building each record, add it to the external dataset using the retrdms.external.addrow() or retrspc.external.addrow() command.

      • When creating the external dataset, there are no separate Python commands to specify a date period, filter, or maximum number of data points. The external dataset created by your Python script should specify only the data you want to analyze.

      • Example scripts are provided below.

    2. (optional) In your Python script, use the retrdms.setretropt and retrspc.setretropt commands to set data grouping options for the retrieval. This is useful for Python dashboard retrievals where you cannot change individual chart settings on the fly.

    3. (optional) In your Python script, retrieve data and statistics for the external dataset you have built, using the Python statistics commands. This can be especially helpful when testing and debugging your script.

DMS external data commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

retrdms.external.adddefect(description, count)

retrdms.external.adddefect("Scratch", 3)

Adds a defect entry for this record. You can add up to 20 defect entries per record.

Each defect entry specifies a brief description of the defect and a count of how many times this defect was found.

You can specify a defect description that does not already exist in DMS, unless you are performing cost analysis based on defect cost. (If defect cost is needed, you must specify a defect description that already exists in DMS.) If you save this external dataset in GainSeeker, any defect description that does not already exist in DMS will be added to GainSeeker.

8.8

retrdms.external.addrow()

retrdms.external.addrow()

Stores the fields as a record in the external dataset.

  • If no fields are set, default values will be used.

  • Duplicate DateTimes are automatically incremented (based on the Show time to configuration setting).

Retrieves information for the first standard and process.

Clears the following fields in preparation for the next record to be built:

  • retrdms.external.adddefect

  • retrdms.external.ncu

  • retrdms.external.note

  • retrdms.external.event

All other fields and properties for the external dataset are left unchanged (retrdms.external.autosumncu, retrdms.external.datetime, retrdms.external.partno, retrdms.external.process, retrdms.external.samplesize, and retrdms.external.settrace).

Sets retrdms.useexternal = True.

Resets the statistics for the external dataset to include this record.

8.8

retrdms.external.autosumncu

retrdms.external.autosumncu = True

If True, executing retrdms.external.adddefect will automatically update the sum of nonconforming units for the record (retrdms.external.ncu) with the count of the new defect being added.

The default for this property is determined in configuration settings.

8.8

retrdms.external.clear()

retrdms.external.clear()

Clears all records and statistics for the external dataset.

8.8

retrdms.external.datetime

retrdms.external.datetime = "10/30/2017 16:10:32"

retrdms.external.datetime = hsidate.dbdatetimestr()

Gets/Sets the DateTime field for this record (either in GainSeeker database format or international format).

If not set:

  • for the first record under the current standard in the external dataset, the computer date and time will be used.

  • for any other record, the DateTime from the previous record under the current standard will be incremented (based on the Show time to configuration setting) and used.

There are three typical strategies for setting DateTimes in the external dataset:

  • Strategy 1:  Don't set the DateTime.

    • GainSeeker will apply the computer date and time to the first record and increment it for the other records in the dataset.

  • Strategy 2:  Only set the DateTime for the first record.

    • GainSeeker will increment that DateTime for the other records in the dataset.

  • Strategy 3:  Set the DateTime for each record.

    • When your source data already specifies a Date/Time for each sample, it makes sense to show that in your external dataset.

8.8

8.9

retrdms.external.event

retrdms.external.event = "Broken"

Gets/Sets the Event field for this record.

Defaults to an empty string.

You can specify a DMS Event that does not already exist in GainSeeker. If you save this external dataset in GainSeeker, any DMS Event that does not already exist in GainSeeker will be removed from this data record.

Note: The total number of DMS Events - those that already exist in GainSeeker plus new DMS Events in your external dataset - cannot exceed 65.

8.8, 9.1

retrdms.external.ncu

retrdms.external.ncu = 2

Gets/Sets the NCU field (number of NonConforming Units) for this record.

Defaults to zero and cannot be greater than the sample size for the record.

If retrdms.external.autosumncu is True, do not use this command to manually set the number of nonconforming units. (Manually setting the NCU when autosumncu is True can produce unexpected results.)

8.8

retrdms.external.note

retrdms.external.note = "Halted 10 minutes for fire drill."

Gets/Sets the Note field for this record.

Defaults to an empty string.

8.8

retrdms.external.partno

retrdms.external.partno = "Prototype 17"

Gets/Sets the Part Number field for this record.

If left blank, will be set to "External Data".

You can specify one or more Part Numbers for the dataset.

You can specify a DMS standard (combination of this Part Number and retrdms.external.process) that does not already exist in GainSeeker. If you save this external dataset in GainSeeker and the DMS standard does not exist, GainSeeker will offer to create the standard for you.

The first time you use retrdms.external.addrow() to add a record to the external dataset, GainSeeker will retrieve the standard you specify (if it exists).

8.8

8.9

retrdms.external.process

retrdms.external.process = "Drying"

Gets/Sets the Process field for this record.

If left blank, will be set to "External Data".

You can specify one or more Processes for the dataset.

You can specify a Process that does not already exist in GainSeeker. If you save this external dataset in GainSeeker and the Process does not exist, GainSeeker will offer to create the DMS standard for you (including the Process).

The first time you use retrdms.external.addrow() to add a record to the external dataset, GainSeeker will retrieve the process you specify (if it exists).

8.8

retrdms.external.samplesize

retrdms.external.samplesize = 25

Gets/Sets the Sample Size field for this record.

Defaults to zero.

There are two typical strategies for setting the Sample Sizes in the external dataset:

  • Strategy 1:  Only set the Sample Size for the first record.

    • If you don't change the Sample Size, subsequent records in the dataset will use the same value.

  • Strategy 2:  Set the Sample Size for each record.

    • When your source data already specifies a Sample Size for each sample, it makes sense to use that in your external dataset.

8.8

retrdms.external.settrace(index, value)

retrdms.external.settrace(4, "Dryer 3")

Sets a traceability field value for this record.

The index specifies which traceability field you are setting and must be an integer from 1 to 48, up to the maximum traceability field defined for the current configuration. (Attempts to set traceability values for indexes higher than the maximum defined for the current configuration will be ignored.)

Traceability fields are empty by default.

For any one traceability field, there are two typical strategies for setting the traceability values in the external dataset:

  • Strategy 1:  Only set the traceability value for the first record.

    • If you don't change the value for this traceability field, subsequent records in the dataset will use the same value.

  • Strategy 2:  Set the traceability value for each record.

    • When your source data already specifies a traceability value for each sample, it makes sense to use that in your external dataset.

8.8

9.3

Example DMS script

#These will be applied to the entire dataset

retrdms.external.partno =
"14861"
retrdms.external.process =
"Shipping"
retrdms.external.settrace(
1, "Lot 45173") #Lot traceability
retrdms.external.samplesize =
10
retrdms.external.autosumncu =
False

#Individual records

retrdms.external.datetime =
"8/30/2017 07:30:00"
retrdms.external.settrace(
2, "1") #Shift traceability, shift 1
retrdms.external.ncu =
2
retrdms.external.adddefect(
"Wrong Label", 2)
retrdms.external.adddefect(
"Postage Error", 1)
retrdms.external.addrow()

retrdms.external.datetime =
"8/30/2017 15:30:00"
retrdms.external.settrace(
2, "2") #Shift traceability, shift 2
#no defects or nonconforming units in this sample
retrdms.external.addrow() 

retrdms.external.datetime =
"8/30/2017 23:30:00"
retrdms.external.settrace(
2, "3") #Shift traceability, shift 3
retrdms.external.ncu =
4
retrdms.external.adddefect(
"Postage Error", 4)
retrdms.external.event =
"New staff"
retrdms.external.note =
"Training new personnel"
retrdms.external.addrow()

#Debug script to show external dataset
mypartnos = statdms.data.partno()
myprocesses = statdms.data.process()
mylots = statdms.data.trace(
1)
mysmplsizes = statdms.data.samplesize()
mydatetimes = statdms.data.datetimedisp()
myshifts = statdms.data.trace(
2)
myncus = statdms.data.ncu()
mynumgood = statdms.data.numgood()
mydefect01 = statdms.data.defect(
1)
mydefctcount01 = statdms.data.defectcnt(
1)
mydefect02 = statdms.data.defect(
2)
mydefctcount02 = statdms.data.defectcnt(
2)
myevents = statdms.data.eventdms()

SPC external data commands

Syntax

Example

Description/Remarks

New or changed in GainSeeker version

retrspc.external.adddata(value)

retrspc.external.adddata(23.526)

Sets the measurement value in the next Data field for this record. Also increments the value of the Subgroup Size for this record (see retrspc.external.subgroupsize).

Value can be either a number or None (for a measurement that is missing from the subgroup).

GainSeeker does not check for real-time failures in external SPC data, but you can perform your own checks and manually flag this record with real-time failure codes. See retrspc.external.rtf .

For a different method of setting measurement values for this record, see retrspc.external.setdata .

8.8

retrspc.external.addrow()

retrspc.external.addrow()

Stores the fields as a record in the external dataset.

  • If no fields are set, default values will be used.

  • Duplicate DateTimes are automatically incremented (based on the Show time to configuration setting).

Retrieves information for the first standard.

Clears the following fields in preparation for the next record to be built:

  • retrspc.external.adddata / retrspc.external.setdata

  • retrspc.external.anchorpoint

  • retrspc.external.note

  • retrspc.external.rtf

  • retrspc.external.setactiontaken

  • retrspc.external.setcause

  • retrspc.external.setevent

  • retrspc.external.subgroupsize

All other fields and properties for the external dataset are left unchanged (retrspc.external.datetime, retrspc.external.partno, and retrspc.external.settrace).

Sets retrspc.useexternal = True.

Resets the statistics for the external dataset to include this record.

All other fields and properties for the external dataset are left unchanged.

8.8

retrspc.external.anchorpoint

retrspc.external.anchorpoint = True

Gets/Sets if the record is an anchor point.

Defaults to False.

Possible values are True or False.

8.8

retrspc.external.clear()

retrspc.external.clear()

Clears all records and statistics for the external dataset.

8.8

retrspc.external.datetime

retrspc.external.datetime = "10/30/2017 16:10:32"

retrspc.external.datetime = hsidate.dbdatetimestr()

Gets/Sets the DateTime field for this record (either in GainSeeker database format or international format).

If not set:

  • for the first record under the current standard in the external dataset, the computer date and time will be used.

  • for any other record, the DateTime from the previous record under the current standard will be incremented (based on the Show time to configuration setting) and used.

There are three typical strategies for setting DateTimes in the external dataset:

  • Strategy 1:  Don't set the DateTime.

    • GainSeeker will apply the computer date and time to the first record and increment it for the other records in the dataset.

  • Strategy 2:  Only set the DateTime for the first record.

    • GainSeeker will increment that DateTime for the other records in the dataset.

  • Strategy 3:  Set the DateTime for each record.

    • When your source data already specifies a Date/Time for each sample, it makes sense to show that in your external dataset.

8.8

8.9

retrspc.external.note

retrspc.external.note = "Halted 10 minutes for fire drill."

Gets/Sets the Note field for this record.

Defaults to an empty string.

8.8

retrspc.external.partno

retrspc.external.partno = "Prototype 17"

Gets/Sets the Part Number field (the name of the SPC standard) for this record.

If left blank, will be set to "External Data".

You can specify one or more Part Numbers for the dataset.

You can specify an SPC standard that does not already exist in GainSeeker. If you save this external dataset in GainSeeker and the SPC standard does not exist, GainSeeker will offer to create the standard for you.

The first time you use retrspc.external.addrow() to add a record to the external dataset, GainSeeker will retrieve the standard you specify (if it exists).

8.8

retrspc.external.rtf

retrspc.external.rtf = 16386

retrspc.external.note = "X-bar below control limit | Range run above mean"

Flags this data record with real-time failure codes 2 (X-bar below control limit) and 16384 (Range run above mean), and sets meaningful descriptions of the failures in the note for this record.

Gets/Sets the real-time failure value for this record.

Defaults to zero (no failures).

GainSeeker does not check for real-time failures when external data is added, but you can perform your own checks* and manually flag this record with real-time failure codes. For a reference of the failures and their associated code numbers, see Real-time Failure codes. These codes are used when displaying real-time failure colors on the dashboard grid and on the Monitor Table.

Please note that flagging a record with real-time failure codes does not automatically set a failure note for the record. If you flag this record with real-time failure codes, you should also add to the failure note using retrspc.external.note :

  • When one data record has both a real-time failure flag and a note, it will be displayed on a Control Chart using the "Failure Note" symbol. With the failure flag but no note, this record will be displayed like "normal" data with no real-time failures.

  • The failure note should briefly describe the failure(s) for the record, so that the user can understand why it has been flagged with real-time failures.

* As an alternative to programming your own real-time checks, you could use the following strategy to let GainSeeker do this work for you:

  1. Manually create an SPC standard for this data, and set the real-time checks that GainSeeker should perform for you.
  2. Write a Python script that:
    1. first deletes all data for this new SPC standard,
    2. then reads only the data you want to analyze now
    3. and uses the dataspc commands (instead of the retrspc.external commands) to store that data in GainSeeker.
  3. Use the GainSeeker Inspections module to execute this script as a standalone script.
    (This data that you just imported will only exist temporarily in GainSeeker, because the script will delete this data the next time you run it.)
  4. Use the GainSeeker Charts module to analyze this stored data.

8.8

retrspc.external.setactiontaken(description, shortcode)

retrspc.external.setactiontaken("Replaced Filter", "RF")

Sets the Action Taken field for this record.

Both arguments default to empty strings.

The shortcode is used for display on a Control chart. It must be 1-4 characters long.

You can specify an Action Taken that does not already exist in GainSeeker. If you save this external dataset in GainSeeker, any Action Taken that does not already exist in GainSeeker will be removed from this data record.

8.8

retrspc.external.setcause(description, shortcode)

retrspc.external.setcause("Clogged Filter", "CF")

Sets the Cause field for this record.

Both arguments default to empty strings.

The shortcode is used for display on a Control chart. It must be 1-4 characters long.

You can specify a Cause that does not already exist in GainSeeker. If you save this external dataset in GainSeeker, any Cause that does not already exist in GainSeeker will be removed from this data record.

8.8

retrspc.external.setdata(index, value)

retrspc.external.setdata(4, 23.526)

Sets the fourth measurement in this subgroup to 23.526 . If Subgroup Size field is less than four, raises it to four.

Sets the measurement value for the Data field specified by index.

Index must be an integer from 1 to 72. It tells GainSeeker which of the Data fields in the subgroup should be filled with the measurement value.

If the index is greater than the Subgroup Size for this record (see retrspc.external.subgroupsize), this also raises the Subgroup Size.

Data fields are empty by default.

Value can be either a number or None (for a measurement that is missing from the subgroup).

GainSeeker does not check for real-time failures in external SPC data, but you can perform your own checks and manually flag this record with real-time failure codes. See retrspc.external.rtf .

For a different method of setting measurement values for this record, see retrspc.external.adddata .

8.8

retrspc.external.setevent(description, shortcode)

retrspc.external.setevent("Insufficient Oxygen", "O2")

Sets the Event field for this record.

Both arguments default to empty strings.

The shortcode is used for display on a Control chart. It must be 1-4 characters long.

You can specify an Event that does not already exist in GainSeeker. If you save this external dataset in GainSeeker, any Event that does not already exist in GainSeeker will be removed from this data record.

8.8

retrspc.external.settrace(index, value)

retrspc.external.settrace(4, "Dryer 3")

Sets a traceability field value for this record.

The index specifies which traceability field you are setting and must be an integer from 1 to 48, up to the maximum traceability field defined for the current configuration. (Attempts to set traceability values for indexes higher than the maximum defined for the current configuration will be ignored.)

Traceability fields are empty by default.

For any one traceability field, there are two typical strategies for setting the traceability values in the external dataset:

  • Strategy 1:  Only set the traceability value for the first record.

    • If you don't change the value for this traceability field, subsequent records in the dataset will use the same value.

  • Strategy 2:  Set the traceability value for each record.

    • When your source data already specifies a traceability value for each sample, it makes sense to use that in your external dataset.

8.8

9.3

retrspc.external.subgroupsize

mysubsize = retrspc.external.subgroupsize

Gets the Subgroup Size of this record.

The Subgroup Size is incremented automatically when adding data values with retrspc.external.adddata or retrspc.external.setdata .

8.8

Example SPC script

#These will be applied to the entire dataset

retrspc.external.partno =
"14861 weight"
retrspc.external.settrace(
1, "Lot 45173") #Lot traceability

#Individual records

retrspc.external.datetime =
"8/30/2017 07:30:00"
retrspc.external.settrace(
2, "1") #Shift traceability, shift 1
retrspc.external.adddata(
13.17) #use adddata command
retrspc.external.adddata(
13.16)
retrspc.external.adddata(
13.21)
retrspc.external.addrow()

retrspc.external.datetime =
"8/30/2017 15:30:00"
retrspc.external.settrace(
2, "2") #Shift traceability, shift 2
retrspc.external.setdata(
1, 13.15) #use setdata command
retrspc.external.setdata(
2, 13.13)
retrspc.external.setdata(
3, 13.22)
retrspc.external.setevent(
"Power Outage", "PWR")
retrspc.external.addrow()

retrspc.external.datetime =
"8/30/2017 23:30:00"
retrspc.external.settrace(
2, "3") #Shift traceability, shift 3
retrspc.external.setdata(
1, 13.29
retrspc.external.setdata(
2, 13.75)
retrspc.external.setdata(
3, 13.24)
retrspc.external.rtf =
1024
retrspc.external.note =
"Sample #2 violates Upper spec limit"
retrspc.external.addrow()

retrspc.external.datetime =
"8/31/2017 07:30:00"
retrspc.external.settrace(
2, "1") #Shift traceability, shift 1
retrspc.external.setdata(
1, 13.27
retrspc.external.setdata(
3, 13.24)
retrspc.external.note =
"Sample #2 removed from lab before weight checks could be performed."
retrspc.external.addrow()

#Debug script to show external dataset
mypartnos = statspc.data.partno()
mylots = statspc.data.trace(
1)
mydatetimes = statspc.data.datetimedisp()
myshifts = statspc.data.trace(
2)
mydata = statspc.data.datapts()
myevents = statspc.data.eventspc()
myrtfs = statspc.data.rtfstr()