So, if the SPC module doesn’t yet handle multiple data points per measurement, how can it calculate the range and standard deviation of a measurement with 1 data point? Doesn’t that ruin the XbarS and XbarR charts?
Ok, I follow what you are suggesting. It’s just not clear how the sample gets updated/added with the new measurement. If I follow your example, with using an existing sample, I made the following code:
[code] #–Get some info about a sample and location that is already setup
dat=event.source.parent.getComponent(‘Table’).data #look at some SPC data in a table
id=str(dat.getValueAt(0,“SampleUUID”)) #pull out the unique ID (of just the first row for now) that is auto created for each measurement sample by the SPC module
sample=system.quality.sample.data.getSample(id) #return the reference to the sample based on the UUID
ent=sample.getEnterprise()+ “\” #get the enterprise string
ste=sample.getSite()+ “\” #get the site string
ar=sample.getArea()+ “\” #get the area string
loc=sample.getLocation() #get the location string
strlocation=ent+ste+ar+loc #build the path string
#—To test, just create a 2nd measurement and write a value to it.
m_num=sample.getSampleDefinition().getMeasurementCount() #how many measurements are there in the current sample? (returns 1)
new_num=sample.getSampleDefinition().setMeasurementCount(2) #set the measuremment count to 2, just to test writing to a new row
val=124 #a randowm number to try out
d=sample.getSampleData(1,“Mean”) #Return the value of the data in row 1. the tag’s name is “Mean”
print d #display the value
newval=sample.setSampleData(new_num,“Mean”,str(val)) # set the value of the data in the new row. the tag’s name is “Mean”
print newval #did the new data get sucessfully written?
system.quality.sample.data.updateSample(strlocation,sample,1) #update the sample [/code]
Everything seems to work fine, except that it doesn’t seem to want to write the sample data in the new row (newval returns “False”).
Also, the updateSample() function returns an error with “Invalid Location string”. Since I know exactly the string, and am reading directly from it, how can it be invalid?