Variance Filters

Sepasoft MES Module Suite

VarianceFilters Object

A VarianceFilters object is used when requesting variances with the system.recipe.getRecipeVariances() script function to narrow down the results that are returned. For example, if you only want variances for a specific production item (machine) and specific date range, the VarianceFilters object properties are set appropriately and are passed as parameters to the system.recipe.getRecipeVariances() script function.

Object Functions

createNew()

Description

Returns a new instance of a VarianceFilters object. After setting various filter properties, it is used with the system.recipe.getRecipeVariances() script function.

Syntax

createNew()

  • Parameters

None

  • Returns

The new VarianceFilters object.

Properties

setFromDate(fromDate)

Description

Set the start of the date range to return variances for if setVarianceScopeTypes("DATE_RANGE") is called.

Syntax

setFromDate(fromDate)

  • Parameters

Date fromDate - The start date for the variance.

  • Returns

Nothing

setIncludeChildren(includeChildren)

Description

Set if children production items under the production item specified by the setItemPath() property, should be included in the variance results.

Syntax

setIncludeChildren(includeChildren)

  • Parameters

boolean includeChildren - Set it True, if you need to include children and False otherwise.

  • Returns

Nothing

setIncludeInitialValues(includeInitialValues)

Description

Set if the initial values (meaning the values when the recipe was first selected) should be included in the variance results.

Syntax

setIncludeInitialValues(includeInitialValues)

  • Parameters

boolean includeInitialValues - Set it True, if you need to include the initial values and False otherwise.

  • Returns

Nothing

setIncludeVarianceValues(includeVarianceValues)

Description

Set if the variance values (meaning the values that changed after the recipe was first selected) should be included in the variance results.

Syntax

setIncludeVarianceValues(includeVarianceValues)


  • Parameters

boolean includeVarianceValues - Set it True, if you need to include the variance values and False otherwise.

  • Returns

Nothing

setItemPath(itemPath)

Description

Set the path of the production item to return variances for.

Syntax

setItemPath(itemPath)

  • Parameters

String itemPath - The item path to a production line, cell, cell group or location. Note that wildcards are not supported.

  • Returns

Nothing

setProjectName(projectName)

Description

Set the project name to read variances. Variances are kept by project, and the project name is required with the getRecipeVariances script function.

Syntax

setProjectName(projectName)

  • Parameters

String projectName - The project name to read the variances for.

  • Returns

Nothing

setRecipe(recipeName)

Description

Set an optional recipe filter. The filter can contain ? and * wild card characters. For example:  "Recipe C*" will include all recipes that start with Recipe C. Recipe C1 and Recipe C21 will be included but Recipe D1 will not.

Syntax

setRecipe(recipeName)


  • Parameters

String recipeName - Name of the recipe value. This is the same name entered in the recipe value entry in the designer.

  • Returns

Nothing

setRecipeValueName(recipeValueName)

Description

Set an optional recipe value name filter. The filter can contain ? and * wild card characters.

Syntax

setRecipeValueName(recipeValueName)

  • Parameters

String recipeValueName - Name of the recipe value. This is the same name entered in the recipe value entry in the designer.

  • Returns

Nothing

setSubRecipe(subRecipeName)

Description

Set an optional sub recipe filter. The filter can contain ? and * wild card characters.

Syntax

setSubRecipe(subRecipeName)

  • Parameters

String subRecipeName - Name of the subRecipe value. This is the same name entered in the subRecipe value entry in the designer.

  • Returns

Nothing

setToDate(toDate)

Description

Set the end of the date range to return variances for if setVarianceScopeTypes("Date_Range") is called.

Syntax

setToDate(toDate)

  • Parameters

Date toDate - End date for the variance.

  • Returns

Nothing

setVarianceEntryType(varianceType)

Description

Set the variance types to include in the results.

Info

Information

Valid values are :

  • RECIPE to return variances that occurred while a production item was selected to a recipe.
  • SUB_RECIPE to return variances that occurred while a sub product code was selected for a production item.

Syntax

setVarianceEntryType(varianceType)


  • Parameters

String varianceType - This include Recipe and Sub_Recipe as detailed in the Info section.

  • Returns

Nothing

setVarianceScopeTypes(varianceScopeType)

Description

Set the variance scope to include in the results.

Info

Information

Valid values are :

  • Last - Return variances that occurred for the current or last recipe that a production item was set. This is useful for detecting any variances in real time for a production run. If the production run has stopped, it will return the variances as long as a new recipe has not been selected for the production item.
  • Date_Range - Return variances for the date range specified with the setFromDate() and setToDate() properties.

Syntax

setVarianceScopeTypes(varianceScopeType)

  • Parameters

String varianceScopeType - This include Last and Date_Range as detailed in the Info section.

  • Returns

Nothing

Code Snippets

Python
#Collection values we want to filter by
projectName = system.util.getProjectName()
itemPath = event.source.parent.getComponent('Production Line Selector').selectedPathWithoutProject
 
#Build the filters object
filters = system.recipe.filter.variance.createNew()
filters.setProjectName(projectName)
filters.setVarianceEntryType("Recipe")
filters.setVarianceScopeTypes("Last")
filters.setItemPath(itemPath)
filters.setIncludeChildren(False)
 
#Request the variances for the given filters
ds = system.recipe.getRecipeVariances(filters)
event.source.parent.getComponent('Table').data = ds

Sepasoft MES Module Suite