Sample Data

Sepasoft MES Module Suite

The sample object holds a sample data object for each attribute and measurement. When a sample object is created, it automatically creates a sample data object based on the sample definition.

Example:

If sample definition viscosity has two attributes of cold viscosity and temperature and is configured for 5 measurements, then the sample will contain 10 sample data objects. Five measurements for cold viscosity and five measurements for temperature.

Object Functions


getAttrDataType()



Description

Returns attribute data type of this sample data object. This is automatically set when the sample is created and is based on the sample definition.

Syntax

getAttrDataType()


  • Parameters

None

  • Returns

AttributeDataType The attribute data type of this sample data object.

Code Example

Code
sampleUUID = '41bf94c9-f51d-45e8-885d-530e9f54cbc7' 
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
print type(sampleData.getAttrDataType())
print sampleData.getAttrDataType()
>>> 
<type 'com.sepasoft.production.common.model.mesobject.property.spc.attribute.AttributeDataType'>
Real
>>> 

getAttrName()

Description

Returns the attribute name this sample data object is associated with.

Syntax

getAttrName()


  • Parameters

None

  • Returns

String attrName - The attribute name of this sample data.

Code Example

Code
sampleUUID = '41bf94c9-f51d-45e8-885d-530e9f54cbc7'
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
print sampleData.getAttrName()
>>> 
att1
>>> 

getAttrValue()

Description

Returns the data value for this sample data object.

Syntax

getAttrValue()


  • Parameters

None

  • Returns

Object attrValue - The data value for this sample data.

Code Example

Code
sampleUUID = '41bf94c9-f51d-45e8-885d-530e9f54cbc7'
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
print sampleData.getAttrValue()
>>> 
2.0
>>> 

getAttrValueAsString()

Description

Returns the value for this sample data object as a string.

Syntax

getAttrValueAsString()


  • Parameters

None

  • Returns

The attribute value as string.

getMeasNo()

Description

Returns the measurement number this sample data object is associated with.

Syntax

getMeasNo()


  • Parameters

None

  • Returns

Integer measNo - The measurement number of this sample data.

Code Example

Code
sampleUUID = '41bf94c9-f51d-45e8-885d-530e9f54cbc7'
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
print sampleData.getMeasNo()

getMeasured()

Description

Checks whether this sample data is measured or not.

Syntax

getMeasured()


  • Parameters

None

  • Returns

boolean isMeasured - True, if this sample data is measured and False otherwise.

getSampleUUID()

Description

Returns the sample UUID that this sample data object belongs to.

Syntax

getSampleUUID()


  • Parameters

None

  • Returns

String sampleUUID - The uuid of this sample.

getSampleValidationErrors()

Description

Validates the sample and returns an error message if the sample is invalid.

Syntax

getSampleValidationErrors()


  • Parameters

None

  • Returns

String result - The message explaining why the sample is invalid.

Code Example

Code
sampleUUID = '385b27b4-a6ce-4d85-9cbe-8a85abd59c21'
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
print sampleData.getSampleValidationErrors()
>>> 
Value cannot be null
>>>

hasAttrValue()

Description

Returns true if attribute value is not equal to null.

Syntax

hasAttrValue()


  • Parameters

None

  • Returns

boolean - True if there is an attribute value associated with this sample data.

isModified()

Description

Returns true if the value of this sample data object has been modified.

Syntax

isModified()


  • Parameters

None

  • Returns

 True, if value of the sample has been modified.

isNew()

Description

Returns true if the value of this sample data object is a newly created one.

Syntax

isNew()


  • Parameters

None

  • Returns

 True, if value of the sample has unassigned ID.

isValueValid()

Description

Returns true if the value of this sample data object has been set and is between minimum and maximum values.

Syntax

isValueValid()


  • Parameters

None

  • Returns

 True, if value of the sample is valid.

resetModified()

Description

This script function will undo the modification.

Syntax

resetModified()


  • Parameters

None

  • Returns

 Nothing

setAttrValue(attrValue)

Description

Sets the value for this sample data object. If the attrValue parameter is not the correct data type, an attempt to convert it to the correct data type is performed before it is set.

Syntax

setAttrValue(attrValue)


  • Parameters

Object attrValue - The data value to set the sample data for.

  • Returns

Nothing 

Code Example

Code
sampleUUID = '385b27b4-a6ce-4d85-9cbe-8a85abd59c21'
sample = system.mes.spc.sample.getSample(sampleUUID)
sampleData = sample.getSampleData(1, 'att1')
sampleData.setAttrValue(3.0)
system.mes.spc.sample.update(sample, True)

setMeasured(isMeasured)

Description

Sets the boolean indicating that the sample data is measured or not.

Syntax

setMeasured(isMeasured)


  • Parameters

boolean isMeasured - Set to True if the sample data is already measured or else set to False.

  • Returns

Nothing

toString()

Description

Gets the attribute value as string.

Syntax

toString()


  • Parameters

None

  • Returns

 The attribute value as string.




Sepasoft MES Module Suite