Sepasoft MES Module Suite
MES Sample Filter
An instance of the MES Sample Filter object is created whenever a filter is created using the Location Sample List component and also by the system.quality.sample.data.getSampleList() scripting function.
The MES Work Order object is derived from the MESAbstractObject and inherits all of its exposed properties, methods and events as well as adds the ones documented in this section.
Object Creation
Use with:
system.quality.sample.data.createFilter(locationPath)
system.mes.spc.sample.createFilter(locationPath)
Create a sample filter to retrieve sample data via filter parameters. Used in conjunction with system.mes.spc.sample.getSampleList
For sort keys, see sortType Key.
|
Scripting Function modifications in MES 3.79.3 RC 5 and later |
Syntax
system.mes.spc.sample.createFilter(locationPath)
- Parameters
String locationPath - The location path (equipment path with at least one location) to use.
- Returns
- Scope
All
Code Example
Python |
location_path = "Enterprise\Site 1\Area 1\Location 1" sample_filter = system.mes.spc.sample.createFilter(location_path) sample_filter.setSortType("Taken Date Time (Descending)") sample_filter.setLocationPath(location_path) sample_filter.setStartDate(system.date.addMinutes(system.date.now(), -2)) sample_filter.setEndDate(system.date.addMinutes(system.date.now(), 4)) #sample_filter.setStartDate(system.date.parse("2021-11-05 13:00:00")) #sample_filter.setEndDate(system.date.parse("2021-11-05 23:00:00")) sample_filter.setShowDueSamples(True) sample_filter.setShowComingDueSamples(True) sample_filter.setShowOverDueSamples(True) sample_filter.setShowWaitingApproval(False) sample_filter.setShowApprovedSamples(False) sample_filter.setShowRemovedSamples(False) print "State:", sample_filter.getSampleStateTypes().getState() results = system.mes.spc.sample.getSampleList(sample_filter) print results.getRowCount() print results.getColumnNames() for i in range(results.getRowCount()): row = [] for j in range(results.getColumnCount()): row.append(results.getValueAt(i, j)) print row |
system.quality.sample.data.getSampleList(samplefilter)
system.mes.spc.sample.getSampleList(samplefilter)
Returns a sample list that matches the filter parameter. Used with system.mes.spc.sample.data.createFilter(location_path).
For sort keys, see sortType Key.
system.mes.spc.sample.getSampleList(samplefilter) → Dataset
Syntax
system.mes.spc.sample.data.getSampleList(samplefilter)
- Parameters
MESSampleFilter sampleFilter - MES Sample filter to use.
- Returns
Dataset - Samples for a specified location path (equipment path with a sampling location configured).
- Scope
All
Code Example
Python |
location_path = "Enterprise\Site 1\Area 1\Location 1" sample_filter = system.mes.spc.sample.createFilter(location_path) sample_filter.setSortType("Taken Date Time (Descending)") sample_filter.setLocationPath(location_path) sample_filter.setStartDate(system.date.addMinutes(system.date.now(), -2)) sample_filter.setEndDate(system.date.addMinutes(system.date.now(), 4)) #sample_filter.setStartDate(system.date.parse("2021-11-05 13:00:00")) #sample_filter.setEndDate(system.date.parse("2021-11-05 23:00:00")) sample_filter.setShowDueSamples(True) sample_filter.setShowComingDueSamples(True) sample_filter.setShowOverDueSamples(True) sample_filter.setShowWaitingApproval(False) sample_filter.setShowApprovedSamples(False) sample_filter.setShowRemovedSamples(False) print "State:", sample_filter.getSampleStateTypes().getState() results = system.mes.spc.sample.getSampleList(sample_filter) print results.getRowCount() print results.getColumnNames() for i in range(results.getRowCount()): row = [] for j in range(results.getColumnCount()): row.append(results.getValueAt(i, j)) print row |
Code Example
Code |
|
Object Functions
This object provides the following functions:
setSortType(sortType)
Description
Takes sortType which is a SampleSortingType.
For example:
("Taken Date Time (Descending)" )
Syntax
setSortType(sortType)
- Parameters
String sortType - SampleSortingType
- Returns
Nothing
- Scope
All
setLocationPath('locationPath')
Description
Sets the required location path. The location path is an equipment path with at least one location.
Syntax
setLocationPath('locationPath)
- Parameters
String locationPath - A location path is an equipment path with at least one location.
- Returns
Nothing
- Scope
All
setStartDate()
Description
Sets the start date defined in the filter as a Date Type.
For example:
#sample_filter.setStartDate(system.date.parse("2021-11-05 13:00:00"))
Syntax
setStartDate()
- Parameters
Date Type startDate - Date to start the filter.
- Returns
Nothing
- Scope
All
setEndDate(endDate)
Description
Sets the date to add as the end in the filter for samples.
For example:
#sample_filter.setEndDate(system.date.parse("2021-11-05 23:00:00"))
Syntax
setEndDate(endDate)
- Parameters
Date Type endDate - Date specified as the cut off for the sample list in the filter.
- Returns
Nothing
- Scope
All
setShowDueSamples()
Description
Includes the samples that are in the Due state when set to True. The default is True.
Syntax
setShowDueSamples()
- Parameters
Boolean isShowDueSamples - Defaults to True.
- Returns
Nothing
- Scope
All
setShowComingDueSamples()
Description
Includes the samples that are in the Coming Due state when set to True. The default is True.
Syntax
setShowComingDueSamples()
- Parameters
Boolean isShowComingDueSamples - Defaults to True.
- Returns
Nothing
- Scope
All
setShowOverDueSamples()
Description
Includes the samples that are in the Over Due state when set to True. The default is True.
Syntax
setShowOverDueSamples()
- Parameters
Boolean isShowOverDueSamples - Defaults to True.
- Returns
Nothing
- Scope
All
setShowWaitingApproval()
Description
Includes the samples that are in the Waiting Approval state when set to True. The default is True.
Syntax
setShowWaitingApproval()
- Parameters
Boolean isShowWaitingApproval - Defaults to True.
- Returns
Nothing
- Scope
All
setShowApprovedSamples()
Description
Includes the samples that are in the Approved state when set to True. The default is True.
Syntax
setShowApprovedSamples()
- Parameters
Boolean isShowApprovedSamples - Defaults to True.
- Returns
Nothing
- Scope
All
setShowApprovedSamples()
Description
Includes the samples that are in the Removed state when set to True. The default is False.
Syntax
setShowRemovedSamples()
- Parameters
Boolean isShowRemovedSamples - Defaults to False.
- Returns
Nothing
- Scope
All
Sepasoft MES Module Suite