Checkware JsManager

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.

Main workflow

The main workflow is rather simple:

  • The checklist calls a function on its instance of JsManager.
  • JsManager takes the data and calls a corresponding function in Checkware or the App.
  • After handling the request, Checkware / the App calls the callback function on the JsManger.
  • The JsManager passes the data through to the checklist by calling the checklist's callback function.

JsManager API

JsManager object

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.

Functions

CompleteChecklist()

Is called to close a checklist, disabling any further input. This is generally called via the Complete Button component in Checkware Designer.

  • Parameter
{
        jsonString: string, // the matchCodes & Fields used in the checklist
        html: string          // deprecated and not used anymore
}
  • Return Promise<void>
  • Example
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"> *[...]*");

ConnectorCall()

Used to connect to a server and call custom functionality for this checklist, e.g. getting specific data or performing specific calculations.

  • Parameter
{
        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
}
  • Return void
  • Example
JsManager.ConnectorCall("Server009", "Add", JSON.stringify({Number1: self.CONNECTORINTA(), Number2: self.CONNECTORINTB()}), "ConnectorCallback");

DocumentReady()

ToDo

  • Parameter
{
        
}
  • Return Promise<string>
  • Example

ExportPdf()

Not yet implemented

OpenDialog()

Opens a dialog that shows some information to the user.

  • Parameter
{
        html: any,           // the dialog to show in html
        options = null,      // not yet implemented
        callbackName = null  // not yet implemented
}
  • Return void
  • Example

OpenQuestionDialog()

Opens a question dialog for a simple yes/no question.

  • Parameter
{
        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
}
  • Return Promise<boolean>
  • Example
JsManager.OpenQuestionDialog("Do you want close this part of the checklist?", "", "CloseChecklistPart");

OpenSignSignotecDialog()

Deprecated

OpenSignDialog()

Brings up a dialog where the user can sign the checklist with his signature. Generally used by the Signature component in Checkware Designer.

  • Parameter
{
        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
}
  • Return Promise<any>
  • Example
JsManager.OpenSignDialog("SIG_CUSTOMER", "SIG_CUSTOMER_DATE", "SIG_CUSTOMER_NAME", true, false); 

Save()

Saves the current evaluation.

  • Parameter
{
        json: string     // a JSON string of all the fields used in the checklist and that should be saved
}
  • Return Promise<void>
  • Example
JsManager.Save("{"CompleteDate":null,"ChecklistId":"78962bd1-5a63-4fa5-ba2b-0083c40c9558","EvaluationId":"a006e60c-cf01-44f2-9c4b-60ab6b70281d" *[...]*}");

SetIsDirty()

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.

  • Parameter
{
        newValue: boolean    // if the checklist is marked as dirty or not
}
  • Return void
  • Example
JsManager.SetIsDirty(false);

ShowSearch()

Opens a search dialog where the user can search for an element of a specific table available to Checkware/the App.

  • Parameter
{
        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.
}
  • Return void
  • Example
JsManager.ShowSearch("User", "", false, null, "SearchCallback", false);

TakeBarcode()

To read and save a barcode with the camera/barcode scanner of a mobile device. Usually used with the Barcode component in Checkware Designer.

  • Parameter
{
        matchCode: string   // the matchcode for the barcode to be saved.
}
  • Return void
  • Example
JsManager.TakeBarcode("LOT_001");

TakeLocation()

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.

  • Parameter
{
        matchCode: string    // the matchcode for the coordinates to be saved
}
  • Return void
  • Example
JsManager.TakeLocation("LOCATION");

TakePicture()

Opens the mobile devices' camera to shoot a picture and to save the picture with a caption into the checklist.

  • Parameter
{
        matchCode: string,   // the corresponding matchcode
        caption: string      // the caption added to the picture
}
  • Return void
  • Example
JsManager.TakePic

TriggerChecklistMethod()

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.

  • Parameter
{
        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
}
  • Return void
  • Example
JsManager.TriggerChecklistMethod("ConnectorCallback", "{"result:" "500"}");