SPC sample interval duration problem

In the SPC Module, I have a sample definition test instance that uses a custom interval type to create the test at a set time every day. The test is performed the same day as the instance on Ignition, but the results are not prepared and recorded until the following day. Is there a way to have a test instance become available on one day (to signify that the test was for that day) but not have the data recorded for the test due until the following day.

I have a very basic custom interval that creates a new sample entry at a specified time everyday. What kind of scripting would I need to write to keep the test from becoming overdue until sometime the following day?

This is what I have in the custom interval so far:

time = system.tag.read("[default]Time")

if time.value == 0000:
event.setCreateSample(1)

If you are using the interval to schedule a sample with manually entered measurements, you can add event.setScheduleStart(start date) to your script. This will create a sample with no measurements that will appear in the sample list with a due date and time as specified by the start date parameter. Or another way to look at it is it will schedule a sample with a start time in the future.

If you are the interval to automatically record sample measurements from Ignition tags, then it will create the sample if you include event.setCreateSample(1) in your script.

Make sure the coming due minutes are at least 1440 (one day), else it will not appear correctly in the sample list component. The appearance problem is fixed and will be included in the next release.

Sample script:[code]
from java.util import Calendar

#Get the last time a sample was scheduled
secSinceLastScheduled = event.getSecSinceLastSampleScheduled()

#If a sample has not been scheduled for the next schedule time, schedule a new sample
if secSinceLastScheduled == None or secSinceLastScheduled >= 300:
#Calc the start time to schedule the next sample
#getInterval() must be between 1 and 24
hour = int(event.getInterval())
start = Calendar.getInstance()
start.add(Calendar.DAY_OF_MONTH, 1)
start.set(Calendar.HOUR_OF_DAY, hour)
start.set(Calendar.MINUTE, 0)
start.set(Calendar.SECOND, 0)
event.setScheduleStart(start.getTime())

#Calc the finish time of the sample by adding the duration to the start time
duration = int(event.getDuration() * 60)
finish = Calendar.getInstance()
finish.setTime(start.getTime())
finish.add(Calendar.SECOND, duration)
event.setScheduleFinish(finish.getTime())

#Create new sample - no values are recorded
event.setCreateSample(1)[/code]