The datadms commands in Python™ allow you to build DMS data records and store them in the GainSeeker database.
See Python commands for other commands you can use with GainSeeker.
Syntax |
Example |
Description/Remarks |
New or changed in GainSeeker version |
datadms.autocreatedefects = True |
If True, defects that do not exist in the master defect list are created and added to the list when a defect is set using datadms.setdefect. Defaults to False. Possible values are True or False. |
|
|
datadms.autosumncu = True |
If True, the value of datadms.ncu is set to datadms.sumdefects, The default is determined in configuration settings. |
|
|
datadms.clear() |
datadms.clear() |
Clears all fields. It does not affect database records that are already stored. |
|
datadms.createdefect("My new defect", 3.5) |
Creates a defect with the specified name and cost (optional). The defect is not added to any Process. Returns True if the defect is created successfully. The cost must be a number, it cannot have any currency symbols. |
|
|
datadms.datetime = "4/10/1991 14:51:05" datadms.datetime = hsidate.dbdatetimestr() |
Gets/Sets the DateTime (either in GainSeeker database format or international format). Defaults to an empty string. Will be set to the current date and time if left blank. |
|
|
datadms.defectexists(name) |
if datadms.defectexists("My existing defect"): print "Defect exists" |
Returns True if the defect with the specified name exists. |
|
datadms.eventdms = "my event" |
Gets/Sets the Event field. You must specify the Event description, not the 1-digit short code for the Event. When setting this field the value must already exist in the Event list or it is ignored. Defaults to an empty string. |
|
|
datadms.getdefect(index) |
defect = datadms.getdefect(2) |
Gets the defect description for the given index. The index must be from 1 through 20. |
|
datadms.getdefectcnt(index) |
count = datadms.getdefectcnt(2) |
Gets the defect count for the given index. The index must be from 1 through 20. |
|
datadms.gettrace(index) |
shift = datadms.gettrace(2) |
Gets the traceability field. The index must be from 1 through 48. |
|
datadms.hadgatefailures = True Sets the DMS data record to indicate that a gate failure occurred. |
Sets/Gets the gate failure flag for the DMS data record. True indicates that a gate failure occurred. Defaults to False (no gate failure occurred). Use this command to set or clear the gate failure flag based on your own criteria. It will not be automatically set by other Python commands or built-in data collection features in PC Collect. |
|
|
datadms.incrementdt() |
datadms.incrementdt() |
Increments the datadms.datetime by the minimum allowable time difference between records as determined by configuration settings. Used to bulk store records that do not have a predetermined datetime. |
|
datadms.ncu = 2 |
Gets/Sets the NCU field. Defaults to zero and cannot be greater than the sample size. Automatically set to datadms.sumdefects if datadms.autosumncu is True. |
|
|
datadms.note = "my note" |
Gets/Sets the note for a record. Defaults to an empty string. |
|
|
datadms.partno = "My part" |
Gets/Sets the PartNumber field. Defaults to an empty string. |
|
|
datadms.partnoexists() |
datadms.partnoexists() |
If True, the value of dmsdata.partno and datadms.process exists as a standard. Possible values are True or False. |
|
datadms.process = "My proc" |
Gets/Sets the Process field. Defaults to an empty string. |
|
|
datadms.samplesize |
datadms.samplesize = 4 |
Gets/Sets the SampleSize field. Defaults to zero. |
|
datadms.setdefect(2, "Scratch") |
Sets the defect description. The index must be from 1 through 20. The descriptions must exist in the master defect list, or datadms.autocreatedefects must be True. Use the SetDefectCount function with the same index to set the count for this defect. |
|
|
datadms.setdefectcnt(index, count) |
datadms.setdefectcnt(2, 3) |
Sets the defect count for the defect with the corresponding index. The index must be from 1 through 20. The default value is 0. |
|
datadms.settrace(index, value) |
datadms.settrace(1, "56348") |
Sets the traceability field. Traceability fields are empty by default. The index must be between 1 and 48. |
|
datadms.store() |
Store the fields as a database record. This fails if the dmsdata.process is not set. Trims any leading and trailing spaces from traceability fields (datadms.gettrace / datadms.settrace) before storing. Duplicate date/times are automatically incremented. Returns True if it is successful. Possible return values are True or False. Clears the following fields in preparation for the next record to be built:
|
9.3 |
|
sum = datadms.sumdefects |
Gets the sum of all defect counts. |
|
When high-speed data storage is needed, there are several practices that can improve performance in certain situations.
Use datadms.incrementdt(). This command automatically increments the date/time by the unit specified in your configuration for Show time to (minutes, seconds, or hundredths of seconds). This eliminates the need to perform multiple database calls when storing each record, which is common if the script is storing many records that have the same hour and minute value and don't record a more precise time.
Example:
if previousDate != nextDate:
datadms.datetime = nextDate
previousDate = nextDate
else:
datadms.incrementdt()