Since a checkware is so to say its 'own universe' and cannot directly communicate with Checkware, we need something inbetween that transfers function calls and data from one 'universe' to the other.
Enters the JsManager.
The JsManager is the connecting part between a checklist and Checkware / the Checkware App. It has a couple of functions to facilitate data transfer and to include new functionality in the checklists. Therefore, the number of functions is continuily increasing.
The JsManager is available for usage after the Checklist has finished initializing. All Calls to it and its functionalities must happen after that. The self.Initialized(){ ... } call be used to that end.
The main workflow is rather simple:
Every checklist has an instance of the JsManager class on which we call all functions.
self.CallAddOnServer = function(){
JsManager.ConnectorCall("Server009", "Add", JSON.stringify({Number1: self.CONNECTORINTA(), Number2: self.CONNECTORINTB()}), "ConnectorCallback");
}
In this example, we call a connector via the JsManager, using the ConnectorCall method on the JsManager instance.
Is called to close a checklist, disabling any further input. This is generally called via the Complete Button component in Checkware Designer.
{
jsonString: string, // the matchCodes & Fields used in the checklist
html: string // deprecated and not used anymore
}
JsManager.CompleteChecklist("{"CompleteDate":null,"ChecklistId":"78962bd1-5a63-4fa5-ba2b-0083c40c9558","EvaluationId":"a006e60c-cf01-44f2-9c4b-60ab6b70281d" *[...]*}", "<head><meta http-equiv="X-UA-compatible" content="IE=edge"> <meta charset="utf-8"> *[...]*");
Used to connect to a server and call custom functionality for this checklist, e.g. getting specific data or performing specific calculations.
{
connectorKey: string, // the key/name of the connector as in the database
methodName: string, // the function to call on the connector
parameterJson: string, // a JSON string containing all parameters for the function
callbackMethod: string // the callback method in the checklist to be called after the connector call
}
JsManager.ConnectorCall("Server009", "Add", JSON.stringify({Number1: self.CONNECTORINTA(), Number2: self.CONNECTORINTB()}), "ConnectorCallback");
ToDo
{
}
Not yet implemented
Opens a dialog that shows some information to the user.
{
html: any, // the dialog to show in html
options = null, // not yet implemented
callbackName = null // not yet implemented
}
Opens a question dialog for a simple yes/no question.
{
html: string, // the question that is shown in the dialog (a simple string, no html)
options?: any, // not yet implemented
callbackName?: string // the callback method that is called after the dialog was answered
}
JsManager.OpenQuestionDialog("Do you want close this part of the checklist?", "", "CloseChecklistPart");
Deprecated
Brings up a dialog where the user can sign the checklist with his signature. Generally used by the Signature component in Checkware Designer.
{
relatedField: string, // the matchcode name for this field
matchcodeDate?: string, // matchcode name for the date if you want to show it in a separate field again
matchcodeName?: string, // matchcode name for the name of the signatory if you want to show it in a separate field again
autocompleteName?: boolean, // true: the name field in the dialog should be pre-filled with the name of the current user?
enableTime?: boolean) // true: user can choose not only date but also time for the date
}
JsManager.OpenSignDialog("SIG_CUSTOMER", "SIG_CUSTOMER_DATE", "SIG_CUSTOMER_NAME", true, false);
Saves the current evaluation.
{
json: string // a JSON string of all the fields used in the checklist and that should be saved
}
JsManager.Save("{"CompleteDate":null,"ChecklistId":"78962bd1-5a63-4fa5-ba2b-0083c40c9558","EvaluationId":"a006e60c-cf01-44f2-9c4b-60ab6b70281d" *[...]*}");
Sets the dirty flag of the checklist. If true, the user will be prompted if he would like to save the changes when he tries to close the checklist.
{
newValue: boolean // if the checklist is marked as dirty or not
}
JsManager.SetIsDirty(false);
Opens a search dialog where the user can search for an element of a specific table available to Checkware/the App.
{
searchObjectKey: string, // the key by which the table for the search is selected.
objectValue: any, // Name of the column that should be shown as result. Not relevant for the app.
multiSelect: boolean, // to select multiple items. Not yet available in the app.
customFilter: any, // to further restrict the search. Not yet available in the app.
callbackName: string, // method name to callback with the result
autoSearch: boolean // if search results should be shown immediately. Not relevant for the app.
}
JsManager.ShowSearch("User", "", false, null, "SearchCallback", false);
To read and save a barcode with the camera/barcode scanner of a mobile device. Usually used with the Barcode component in Checkware Designer.
{
matchCode: string // the matchcode for the barcode to be saved.
}
JsManager.TakeBarcode("LOT_001");
Opens a dialog to ask the user if he wants to save his coordinates (longitude/latitude given by the users' mobile device) and to save them.
{
matchCode: string // the matchcode for the coordinates to be saved
}
JsManager.TakeLocation("LOCATION");
Opens the mobile devices' camera to shoot a picture and to save the picture with a caption into the checklist.
{
matchCode: string, // the corresponding matchcode
caption: string // the caption added to the picture
}
JsManager.TakePic
This method calls a method in the checklist. It is used to trigger the callback methods that are passed in various method calls to the JsManager. For example, when you call OpenQuestionDialog(someQuestion, myCallbackMethod), TriggerChecklistMethod is called after receiving the users' answer, calling myCallbackMethod in the checklist.
{
methodname: string, // the name of the method to be called in the checklist
json: string // a JSON string containing any parameters for the callback method
}
JsManager.TriggerChecklistMethod("ConnectorCallback", "{"result:" "500"}");