Writing to database - SPC module

In the SPC Module demo provided to use for trial, I am currently seeing if it will fit all the needs we require. I am looking at trying to record more information than the Demo does when recording spc measurements, however I am unable to find which component/Script is responsible to writing the measurements to the sampledata table in the database. Where or how is this done? Current window I am using is the Basic Test Station.

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.

How do I change what table it writes to in the database?

You don’t. The SPC module creates the tables and indexes automatically. The table structure involves multiple tables and indexes that are optimized for speed when pulling the data out with filters, combining with control limits, etc. and presenting in control charts or other analysis.

You can access the sample data directly from the QUAL_Sample and QUAL_SampleData tables.

What exactly are you trying to accomplish?

Alright.

Trying to accomplish adding more inputs when doing SPCs like userID, ignore min/max features that block from continuing and various other things that have yet to be required by my employer. Having already had problems with some previous table relationships I was trying to make sure I didn’t encounter more moving forward.

Thanks for your help.

Yes, table relationships can be a challenge. But they are needed for speed and database size reasons. The tradeoff is as your system grows its performance will degrade.

We already collect userID, product code, shift information and many other items of information along with the sample. From there you can specify any other user defined information that you also want store along with the sample.

You can also add columns to our database tables. The only restriction is that they must accept null values.

Our table structure for the SPC module is straight forward and I’m happy to show you the layout but it is beyond what can be done over the forum. Feel free to call in and ask for Tom.