Skip to end of metadata
Go to start of metadata


The SPC module provides methods to create samples through scripting without using any visual components.

Applies To and Version Info

This feature applies to the SPC module and is available in all versions.


1. Create a sample definition:

  • Create a sample definition called 'XBarTest' and assigned the location 'QCLab1'. The definition is set for a maximum of 5 measurements max per attribute.
  • It has two attributes, Attr1 and Attr2:
    • Attr1 is real type and is set for 1 measurement
    • Attr2 is real type and is set for 4 measurements

2. Create a new sample from the definition.

3. Add sample data to the attributes and their measurements.

4. Update/save the sample object.


The following code performs steps 2, 3 and 4:

# sample definition name
defName = 'XBarTest'
# location path that is assigned to the sample definition
locationPath = '[global]\Nuts Unlimited\Folsom\Packaging\QCLab1'
# create a new sample from the definition
sample =, locationPath) #
# use this sample object to set the data for the attributes and their measurements

# this sample definition has two attributes, Attr1 and Attr2, and Attr1 has 1 measurement and Attr2 has 4 measurements
# read the values from existing tags
# NOTE: sample values are passed as strings, they are converted internally to the proper data type.
att1Val ='Quality/QualVal1').value
sample.setSampleData(1, 'Attr1', str(att1Val))

att2Val ='Quality/QualVal2').value
sample.setSampleData(1, 'Attr2', str(att2Val))
att3Val ='Quality/QualVal3').value
sample.setSampleData(2, 'Attr2', str(att3Val))
att4Val ='Quality/QualVal4').value
sample.setSampleData(3, 'Attr2', str(att4Val))
att5Val ='Quality/QualVal5').value
sample.setSampleData(4, 'Attr2', str(att5Val))

# only approved samples display on the chart

# save the sample by calling it's update method, sample, True) #


Get Sample By Definition Name


SPC, Sample Definition, Sample Attribute

    Created By   Pete Low Created Date  Nov 20, 2018 18:59 Last Modified By   Peter Chrissanthis Last Modifed Date   Mar 06, 2019 19:13

  • No labels