Create an instance of the DataService class. Failure likely means Link is not installed.
dataService = new ActiveXObject(“Scantron.Scanning.DataService”);
Hopefully you stored the 14-char SDK license key in web.config or other secure place on your server. Call your app to fetch the key and assign it to Link. Send the status back to your application, perhaps for troubleshooting downstream version/license issues you might encounter.
getLicenseKey(function(licenseKey){
dataService.License = licenseKey
log (dataService.Version)
log (dataService.License)
})
Create a zero footprint session.
clientContext = {}
clientContext.DataFileOption = L_DATA_FILE_OPTON_NOFILES
Populate with URLs to the application definition and profiles. Be aware of case sensitivity for your web server!
clientContext.Application = “../../Content/MyApp.StxAppDef.bin”
We want Link to perform data validation, so use an edit profile
clientContext.EditProfile = “../../Content/MyApp.StxEdtPrf.bin”
Also want scoring performed after successful correction (optional)
clientContext.ScoreProfile = “../../Content/MyApp.StxScrPrf.bin”
Prepare to open a connection to the data service. This entails downloading the scanning metadata and finding the connected scanner. OpenAsync does all of this and notifies us.
Create a client callback object and add the following handlers
clientCallback = {}
Handle the OpenCompleted callback
function OpenCompleted(dataServiceEventArgs){
Obtain a reference to the scanning engine bound to the data service.
scanningManager = dataServiceEventArgs.ScanningManager
}
As each document is successfully scanned, the scanning engine raises the DocComplete event. See if the scanned data has any data errors. If so, somebody will correct the data later, so save it to a temporary store on your server. If the data passed the edit examination phase, transform the data to XML. You should specify a SQL query that generates the XML schema expected by the business tier in your app. Notice that the data is saved in the native ScanTools format. This allows us to apply an edit profile when the same or another user is ready to correct the data, possibly in the same or another web session.
Handle the ScanningManager.DocComplete event.
function DocComplete(scanEventArgs){
// obtain a reference to the document just scanned
doc = scanEventArgs.Document
if (doc.EditState == EditState.esPass){
// document passes edit examination
// transform data to XML
myXMLQuery = “My FOR XML SQL select statement”
xmlData = doc.ExecuteQuery(myXmlQuery)
// send the data home along with the perfected data
saveStudent(doc.DataRecordInNCSFormat, xmlData)
}
else{
// send the data home. It will be queued.
saveStudent (doc.DataRecordInNCSFormat)
}
}
Open the data service, the metadata is downloaded by Link and is available till you call Close
dataService.OpenAsync(ClientContext, clientCallback)
When done, have Link clean up any local resources it used.
dataService.Close()
Add a help topic…
You can make use of an edit profile to drive the data validation and correction process. You use ScanTools Plus at design-time tool to build edit profiles which are a declarative way to specify data validation rules. An edit profile can be applied at scan-time. It can also be used in a correction-only session. You can use one edit profile at scan-time and another post-scan. You can choose to implement your own edit correction rules and methodology or complement the features provided by Link. You can choose to use the edit correction user interface in Link or you can write your own interface. Link allows you to make the tradeoffs, supporting you where needed and staying out of your way at other times. The most important advantage of the built in user interface is time to market. If this is your first exposure to ScanTools Link programming, you saved yourself a bunch of time and effort using well-known functionality. Typical reasons for implementing a custom user interface would be to support additional features such as international cultures, regular expression based validation, spell-check, database driven validation or simply to match the look and feel of your solution.
To create a web based edit-only correction session, follow this procedure.
An application must be specified for us to obtain resolved data (as opposed to the OMR read levels).
clientContext.Application = “../../Content/MyApp.StxAppDef.bin”
clientContext.EditProfile = “../../Content/MyApp.StxEdtPrf.bin”
clientContext.ScoreProfile = “../../Content/MyApp.StxScoPrf.bin”
dataService.OpenAsync(ClientContext,clientCallback)
getStudent(function (data){
// got back data that was previous stored in NCS ASCII format
dataRecordInNCSFormat = data
// Hydrate an IDocument providing object
doc = dataService.LoadDocument (dataRecordInNCSFormat)
// perhaps enable an Edit button on the UI.
})
succeded = dataService.ShowEditCorrectionDialog(doc)
If (succeeded){
// scanned data is perfected, transform it in a format suitable to your business tier
xmlData = doc.ExecuteQuery(myXmlQuery)
// send the data home
saveStudent (doc.DataRecordInNCSFormat, xmlData)
….
// fetch the next record for edit
getStudent()
}
else{
// data record is still failing one or more edits
// Data may be partially corrected, so send it back
// Maybe present it to another user at a later time
saveStudent (doc.DataRecordInNCSFormat)
}
dataService.Close()
To correct data at scan-time, you have two options:
Which method you use depends upon the scanner, your application and the customer preference. We do not recommend that you do any inline correction on a high speed scanner like the iNSIGHT 70/150. If you have an iNSIGHT 4 and doing real-time printing of say a server issued ticket or a score, correction may have to be done inline.
To customize the data correction user interface, create your own UI and data binding. Use a SQL select statement to get the scanned data. Use a SQL Update statement to send the data back to Link. Reapply the edit profile using a select on the Edit Failures table.
See Help on Help for additional information on using this help file. See Scantron Technical Support for additional information on technical support and training options. See the ScanTools Suite System Requirements for further details on hardware and software requirements. ScanTools is a suite of products; the specific information you want may appear in the help for a different module. If you don't find what you're looking for here, try one of the following:
|
Scantron Corporation
Customer Service (forms, products, and services): 1-800-SCANTRON (722-6876) Technical Support: 1-800-445-3141 |
|
Copyright © 1998-2012 Scantron Corporation. All rights reserved. Use permitted only under license. www.scantron.com. No part of the Help or user guides may be reproduced in any form, or by any means, without express permission from Scantron Corporation. LINKS TO THIRD PARTY SITES This help system may contain links to third party websites ("Linked Sites"). The Linked Sites are not under the control of Scantron and Scantron is not responsible for the content of any Linked Site, including without limitation any link contained in a Linked Site or any changes or modifications to a Linked Site. Scantron is not responsible for web casting or any other form of transmission received from any Linked Site. Scantron provides Users with the ability to link the Assessment System to the Linked Sites as a convenience to you, and the inclusion of any link does not imply endorsement by Scantron of the Linked Site or any association with its operators. |