Dynamic Document Display Rotation

I have a requirement to have a screen that will cycle through documents (PDF Viewer) that can be shown at any time range selected by the supervisor. There will be more than one document to cycle and each one can have a different start and stop time. I currently have it setup for the user to select what documents to display and store the path information in a MSSQL database as well as the start and end time to display each document.

I have the query setup to extract the documents to display at each station and storing them in a Client Tag dataset. I am stumped right now on how to actually cycle through the documents. Below is an example of the dataset, which can be much longer.

Start End File
7:00 10:00 C:\Test1.pdf
7:05 9:30 C:\Test2.pdf
9:25 13:00 C:\Test23.pdf

Okay, just so I’m clear on this, it could be cycling through different documents during the day? I ask because of the overlaps of times. Using your example set:

– at 7:00 it’s just displaying Test1
– at 8:00 it cycles through Test1 and Test2
– at 9:45 it cycles through all three documents
– at 12:00 it’s down to just Test3

Am I looking at this rightly?

This is not super clean, I’m sure someone else could write this a little nicer but you could put this in a gateway timer script to create another dataset tag that will have only the paths that you want to display in it.

[code]from java.util import Calendar
tagData = system.tag.read(“path/to/tag”).value
paths = system.dataset.toPyDataSet(tagData)
dataLength = len(paths)
cal = Calendar.getInstance()
nowHour = cal.get(Calendar.HOUR_OF_DAY)
nowMinute = cal.get(Calendar.MINUTE)
acceptedPaths = []
for row in range(0, dataLength):
startHour = paths[row][0][0:paths[row][0].index(":")]
startMinute = paths[row][0][paths[row][0].index(":")+1:]
endHour = paths[row][1][0:paths[row][1].index(":")]
endMinute = paths[row][1][paths[row][1].index(":")+1:]
if int(nowHour) == int(startHour):
if int(nowMinute) >= int(startMinute):
elif int(nowHour) > int(startHour) and int(nowHour) < int(endHour):
elif int(nowHour) == int(endHour) and int(nowMinute) <= int(endMinute):

Write back the accepted path to another data set tag here[/code]

Then in your client pdf display page you can have another script on a timer that will cycle through the data set in the new tag. Hopefully that’s at least helpful to get you started…

Thanks for the input, I have been working on the cycling as I managed to get the required documents to show on a dataset and a table (for viewing). This works well and handles the different times that a document can appear quite well.

SELECT StartTime, EndTime, FileName
FROM tblScreenSequence
WHERE ((StartTime <= CurrentTime) AND (EndTime >= CurrentTime)) AND ({[~]ScreenArea} = 1)

I have a timer that looks at the number of records in the dataset for the “bound” value with the intent of using the timer “value” property to display the FileName in the selected row of the dataset.

I have been working with the table object (would like to just work with the dataset) and am able to do the cycling, but only if I have two or more documents to show. Going from no documents to just one, I cannot get the “selectedRow” value of the table to accept the “0” value. If another document is added and then removed, I see the selectedRow value is 0 as expected.

I can hide the table behind other objects in my application if needed, but would like to work directly with the dataset if possible. I have not had much success tracking down information on working with datasets in expressions or even scripting. Perhaps I will have more success with the dataset than I have had with the table for the selected row.