Sample Definition Attribute

Sepasoft MES Module Suite

Sample Definition Attribute

The sample definition attribute object holds all of the information defining an attribute used in samples. A sample definition attribute specifies the name, data type, default value and more for a single attribute that resides in a sample definition.

Properties

getAttributeDataType()

Description

Returns the attribute data type for this attribute. See Attribute Data Type for more information.

Syntax

getAttributeDataType()


  • Parameters

None

  • Returns

AttributeDataType - The attribute data type object for this sample definition attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getAttributeDataType().getText()
print type(att.getAttributeDataType())
>>> 
Inspected Count
<type 'com.sepasoft.production.common.model.mesobject.property.spc.attribute.AttributeDataType'>
>>> 

getSampleDefaultValue()

Description

Returns the default value for this attribute. If this optional default value exists, the sample’s measurement values associated with this attribute are automatically set to this value when a sample is created.

Syntax

getSampleDefaultValue()


  • Parameters

None

  • Returns

Object defaultValue - The value associated with this sample definition attribute. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getSampleDefaultValue()
>>> 
1
>>> 

getDescription()

Description

Returns the description of this attribute.

Syntax

getDescription()


  • Parameters

None

  • Returns

String description - The description for this sample definition attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
print att.getDescription()
>>> 
my example description
>>> 

isEnabled()

Description

Returns true if this attribute is enabled. If an attribute is disabled, it will not appear during sample entry. Based on the value of the included disabled attributes property on the SPC Selector component, disabled attributes will not show on the control charts.

Syntax

isEnabled()


  • Parameters

None

  • Returns

Boolean True - if this attribute is enabled. 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.isEnabled()
>>> 
True
>>> 

getFormat()

Description

Returns the format for this attribute. The format is used to verify formatting values on the control charts and that entered data is correctly formatted. See Attribute Data Type for more information.

Syntax

getFormat()


  • Parameters

None

  • Returns

String format - The format defined for this sample definition attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getFormat()
>>> 
#0
>>> 

getSampleMaxValue()

Description

Gets the maximum value for this attribute. If this optional maximum value exists, the sample’s measurement values associated with this attribute are required to be less than or equal to this value. The maxValue is not a control limit. This is an input validation tool.

Syntax

getSampleMaxValue()


  • Parameters

None

  • Returns

Object maxValue - The maximum value set for this attribute. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getSampleMaxValue()
>>> 
10
>>> 

getSampleSize()

Description

Gets the measurement count associated with this sample definition attribute.

Syntax

getSampleSize()


  • Parameters

None

  • Returns

int measurementCount - The measurement count associated with this sample definition attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getSampleSize()
>>> 
1
>>> 

getSampleMinValue()

Description

Returns the minimum value for this attribute. If this optional minimum value exists, the sample’s measurement values associated with this attribute are required to be greater than or equal to this value. This is not a control limit, but an input validation tool.

Syntax

getSampleMinValue()


  • Parameters

None

  • Returns

Object minValue - The minimum value set for this attribute. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getSampleMinValue()
>>> 
1
>>> 

getName()

Description

Returns the name of this attribute.

Syntax

getName()


  • Parameters

None

  • Returns

String name - Name of this sample definition attribute.

getMESObject()

Description

Returns the sample definition that this attribute is a child of.

Syntax

getMESObject()


  • Parameters

None

  • Returns

SampleDefinition - The sample definition object that is a parent of this attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getMESObject()
>>> 
SampleDefinition (1f1b2735-e751-4fa2-9f62-5eb3c7b08227, my sampleDef, 0 parents, 0 children, 0 custom properties, 5 complex properties, artifacts not loaded)
>>> 

getRequired()

Description

Returns true if this attribute is required while entering samples. If an attribute is required, a value must be entered before the sample will be saved.

Syntax

getRequired()


  • Parameters

None

  • Returns

True, if this attribute is required. 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
print att.getRequired()
>>> 
True
>>> 

getSampleDefaultWeight()

Description

Returns the weight for this attribute.

Syntax

getSampleDefaultWeight()


  • Parameters

None

  • Returns

Double weight - The quantity for this attribute.

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
print att.getSampleDefaultWeight()
>>> 
1.0
>>> 

setAttributeDataType(dataType)

Description

Sets this attribute’s data type. See Attribute Data Type for more information. 

Syntax

setAttributeDataType(dataType)


  • Parameters

AttributeDataType dataType - The data type that is to be set for this sample definition attribute.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.addAttribute('att123')
att.setAttributeDataType('INSPECTED_COUNT')
sampleDef.save()

setDescription(description)

Description

Sets the description of this attribute.

Syntax

setDescription(description)


  • Parameters

String description - The description to be set for this sample definition attribute.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
att.setDescription('my example description')
sampleDef.save()

setEnabled(enabled)

Description

Sets sample attribute enabled state for the sample definition.

Syntax

setEnabled(enabled)


  • Parameters

boolean enabled - Set this to False to effectively delete the attribute.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att123')
att.setEnabled(False)
sampleDef.save()

setFormat(format)

Description

Sets this attribute’s format. The format is used to verify formatting values on the control charts and that entered data is correctly formatted.

Syntax

setFormat(format)


  • Parameters

String format - The format to set the sample definition attribute for.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setFormat('#0.00')
sampleDef.save()

setSampleDefaultChart(chartType)

Description

Sets the default chart type property of the attribute.  This can be used in spc analysis via the use default chart property, but can also be overridden in spc analysis. 

Syntax

setSampleDefaultChart(chartType)

a

  • Parameters

String chartType - chart type name to set the default chart type. Ex: INDIVIDUAL, XBAR_R, HISTOGRAM

  • Returns Nothing

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleDefaultChart('HISTOGRAM')
sampleDef.save()

setSampleDefaultValue(defaultValue)

Description

Sets the default value for this attribute. If this optional default value exists, the sample’s measurement values associated with this attribute are automatically set to this value when a sample is created.

Syntax

setSampleDefaultValue(defaultValue)

 

  • Parameters

Object defaultValue - The value stored with this sample definition attribute. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information. Use None to clear this value.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleDefaultValue(2.4)
sampleDef.save()

setSampleMaxValue(maxValue)

Description

Sets the maximum value for this attribute. If this optional maximum value exists, the sample’s measurement values associated with this attribute are required to be less than or equal to this value. The maxValue is not a control limit. This is an input validation tool.

Syntax

setSampleMaxValue(maxValue)

 

  • Parameters

Object maxValue - The maximum value to set the attribute for. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information. Use None to clear this value.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleMaxValue(10.0)
sampleDef.save()

setSampleSize(measurementCount)

Info

Information

An attribute cannot be set to have a larger measurement count than its definition.

Description

This is initially set to the measurement count of the sample, during data validation check if the measurements are met.

Syntax

setSampleSize(measurementCount)


  • Parameters

Integer measurementCount - The measurement count to set for. Note that the max number of measurements is 500.

  • Returns

Nothing

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleSize(1)
sampleDef.save()

setSampleMinValue(minValue)

Description

Sets the minimum value for this attribute. If this optional minimum value exists, the sample’s measurement values associated with this attribute are required to be greater than or equal to this value. The minValue is not a control limit. This is an input validation tool.

Syntax

setSampleMinValue(minValue)

 

  • Parameters

Object minValue - The minimum value to set the attribute for. Object type is dependent upon the attribute type for this specific attribute. See Attribute Data Type for more information. Use None to clear this value.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleMinValue(0.5)
sampleDef.save()

setName(name)

Description

Sets the name used for this attribute.

Error

It is recommended that once samples have been created using this name, it should not be changed.

Syntax

setName(name)


  • Parameters

String name - Name to be set for this sample definition attribute.

  • Returns

Nothing 

setOrder(order)

Description

Sets the order for the attribute among the other attributes in the Sample Definition.

Syntax

setOrder(order)


  • Parameters

Integer order - Integer indicating the order of the attribute among the other attributes in the Sample Definition.  Starting at zero.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setOrder(2)
sampleDef.save()

setRequired(enabled)

Description

Sets this attribute required state. If an attribute is required, a value must be entered before the sample will be saved.

Syntax

setRequired(enabled)


  • Parameters

boolean enabled - Set this to True if an attribute is required and False otherwise.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setRequired(True)
sampleDef.save()

setSampleDefaultWeight(weight)

Description

This is the default weight for the attribute. Initially, the weight is used by the pareto chart to give different defects a scale factor.

Syntax

setSampleDefaultWeight(weight)

 

  • Parameters

Double weight - The quantity to set the definition attribute for.

  • Returns

Nothing 

Code Example

Code
defName = 'my sampleDef'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
att = sampleDef.getSampleAttributeProperty('att2')
att.setSampleDefaultWeight(1.0)
sampleDef.save()


Format Strings 

Format strings are used by the getFormat() and setFormat() methods. They consist of one or more of the characters shown in the table below. For example: the format string ##.0 will round to show one decimal place. Search java DecimalFormat for more information.


Symbol

Description

0

A digit. absent digits show as zero

#

A digit, zero shows as absent

.

Placeholder for decimal separator

,

Placeholder for grouping separator

E

Separates mantissa and exponent for exponential formats

;

Separates formats

-

Default negative prefix

%

Multiply by 100 and show as percentage

?

Multiply by 1000 and show as per mille

¤

Currency sign; replaced by currency symbol; if doubled, replaced by international currency symbol; if present in a pattern, the monetary decimal separator is used instead of the decimal separator

X

Any other characters can be used in the prefix or suffix

'

Used to quote special characters in a prefix or suffix 

Value

Pattern

Output

123456.789

###,###.###

123,456.789

123456.789

###.##

123456.79

123.78

000000.000

000123.780

12345.67

$###,###.###

$12,345.67

12345.67

\u00A5###,###.###

¥12,345.67

Sepasoft MES Module Suite