Writing to database - SPC module

The basic Test Station screen setup in the demo uses the Sample Entry component which handles saving the measurement data. It also handles dynamically creating the measurement entry boxes and entry validation based on the sample(test) definition. Look at the Basic Add Sample screen for details on how this is done.

That being said, there are scripting functions that provide support to create and edit samples and the measurements data. This is useful for situations where the Sample Entry component doesn’t meet the requirement such as calculations are being done before the measurement data is saved. Or in you case recording other information at the same time.

Refer the SPC Quality -> Scripting -> Scripting Functions -> system.quality.sample.data section of the MES User Manual. Also refer to the Sample object reference.

Here is an example:

[code]#Create a new sample of the type Viscosity
sample = system.quality.sample.data.getNewByDefName(“Viscosity”, “OEEDemo\Your Enterprise\Site 1\Packaging\Line 1\Line 1 Quality”)

#Add measurement data. Viscosity has a sample size of 3 with 2 attributes of Viscosity and Temperature
sample.setSampleData(1, “Viscosity”, “10000”)
sample.setSampleData(1, “Temperature”, “80”)
sample.setSampleData(2, “Viscosity”, “10005”)
sample.setSampleData(2, “Temperature”, “81”)
sample.setSampleData(3, “Viscosity”, “9995”)
sample.setSampleData(3, “Temperature”, “79”)

#Save the new sample
system.quality.sample.data.updateSample(“OEEDemo\Your Enterprise\Site 1\Packaging\Line 1\Line 1 Quality”, sample, 1)[/code]

In general, just about anything can be done in the SPC module through scripting. The components make it much easier but when they don’t do exactly what you want, the script is there to fall back on. SPC scripts functions can be run on the client or the server.

Depending on the additional information you want to record, additional factors may work.
They are user defined data points that are logged along with the sample information. Once they are logged, they can be shown in charts, tables and reports.