Voting service has the support for exporting voting results to external data storage.
The contents of this topic:
Exporting to text file
SMS Studio writes the complete set of voting results to the file specified by the user.
The file is overwritten each time an export occurs. The external application, which reads the file, should be aware that it will not be able to access the file at the short period of times when the file is being updated.
The voting results are written in the form of tab-delimited text table. Each line in the text file includes the following data:
At the time of exporting, the whole set of voting results is written to the file. To allow external applications to learn the time when the update has been completed, SMS Studio assigns a TimeID value to all the records in the set. The TimeID value contains the time in the following form: yyyyMMddHHmmss.
Exporting to image file
If you specify exporting file with an image file extension (bmp or jpg), SMS Studio will save the voting results chart as image.
Exporting to database
SMS Studio writes the complete set of voting results to the table specified by the user.
At the time of exporting, the whole set of voting results is written to the table. To allow external applications to distinguish between different sets of voting results, SMS Studio assigns a unique TimeID value to all the records in one set. The TimeID value contains the time at which the set has been exported in the following form: yyyyMMddHHmmss.
The table for voting results should have the following fields:
The primary key for this table should be set to the combination of the TimeID and ID fields.
Each time the new set is written to the database, SMS Studio updates the Status table. This table keeps the record of the last completely written set in the voting results table. The Status table should have the following fields:
The primary key for this table should be set to the TableName field.
For example, if the table used for exporting is named Voting, the proper reading of the latest voting results could look like this:
SELECT Answer, Votes
FROM Voting
WHERE TimeID = ( SELECT LastTimeID
FROM Status
WHERE TableName = 'Voting' )
In case that a short time interval is used for exporting, the voting results table can become very large over time. To avoid this situation when the voting history is not of interest, the reader should implement an appropriate method of deleting obsolete sets from the table (for example, after each reading or in regular time intervals).
Exporting to database (simplified)
In the simplified variation of exporting to database, SMS Studio will update the existing set of voting results instead of adding a new set each time. This simplifies the reading of the voting results and also eliminates the need for deleting obsolete sets.
The structure of the tables should be the same as described above, except that the primary key for the voting results table should be set to the ID field only.
For example, the reading of the voting results could look like this:
SELECT Answer, Votes
FROM Voting
None - Do not export voting results.
ODBC Data Source and ODBC Data Source (Simplified) - Export voting results to a database through ODBC interface.
Text or image file - Export voting results to a text or image file.
| Copyright © 2002-2010 CodeSegment. All rights reserved. |