1 Conceptual Map of Scripts



2 Script Structure

Menu path:
[SOAPException: faultCode=SOAP-ENV:Client; msg=Deployment error in SOAP service 'urn:SOAPDOCServer': class name 'deister.webstudio.core.services.soap.serializers.ElementSerializer' could not be resolved as a serializer: deister.webstudio.core.services.soap.serializers.ElementSerializer] at deister.axional.docs.xsl.CMSSOAPClient.__doSOAPCall(CMSSOAPClient.java:102) at deister.axional.docs.xsl.CMSSOAPClient.getDictionaryObjectData(CMSSOAPClient.java:197) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:343) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:440) at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:222) at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:475) at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:208) at org.apache.xpath.objects.XRTreeFragSelectWrapper.execute(XRTreeFragSelectWrapper.java:69) at org.apache.xpath.XPath.execute(XPath.java:337) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:280) at org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:394) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2272) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1358) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:711) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1275) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1253) at deister.axional.server.lang.xsl.XSLProcessor.__execute(XSLProcessor.java:862) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:699) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:691) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
[SOAPException: faultCode=SOAP-ENV:Client; msg=Deployment error in SOAP service 'urn:SOAPDOCServer': class name 'deister.webstudio.core.services.soap.serializers.ElementSerializer' could not be resolved as a serializer: deister.webstudio.core.services.soap.serializers.ElementSerializer] at deister.axional.docs.xsl.CMSSOAPClient.__doSOAPCall(CMSSOAPClient.java:102) at deister.axional.docs.xsl.CMSSOAPClient.getDictionaryObjectData(CMSSOAPClient.java:197) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:300) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:440) at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:222) at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:475) at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:208) at org.apache.xpath.objects.XRTreeFragSelectWrapper.execute(XRTreeFragSelectWrapper.java:69) at org.apache.xpath.XPath.execute(XPath.java:337) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:280) at org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:394) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2272) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1358) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:711) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1275) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1253) at deister.axional.server.lang.xsl.XSLProcessor.__execute(XSLProcessor.java:862) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:699) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:691) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
[SOAPException: faultCode=SOAP-ENV:Client; msg=Deployment error in SOAP service 'urn:SOAPDOCServer': class name 'deister.webstudio.core.services.soap.serializers.ElementSerializer' could not be resolved as a serializer: deister.webstudio.core.services.soap.serializers.ElementSerializer] at deister.axional.docs.xsl.CMSSOAPClient.__doSOAPCall(CMSSOAPClient.java:102) at deister.axional.docs.xsl.CMSSOAPClient.getDictionaryObjectData(CMSSOAPClient.java:197) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:300) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:440) at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:222) at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:475) at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:208) at org.apache.xpath.objects.XRTreeFragSelectWrapper.execute(XRTreeFragSelectWrapper.java:69) at org.apache.xpath.XPath.execute(XPath.java:337) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:280) at org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:394) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2272) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1358) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:711) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1275) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1253) at deister.axional.server.lang.xsl.XSLProcessor.__execute(XSLProcessor.java:862) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:699) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:691) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)
[SOAPException: faultCode=SOAP-ENV:Client; msg=Deployment error in SOAP service 'urn:SOAPDOCServer': class name 'deister.webstudio.core.services.soap.serializers.ElementSerializer' could not be resolved as a serializer: deister.webstudio.core.services.soap.serializers.ElementSerializer] at deister.axional.docs.xsl.CMSSOAPClient.__doSOAPCall(CMSSOAPClient.java:102) at deister.axional.docs.xsl.CMSSOAPClient.getDictionaryObjectData(CMSSOAPClient.java:197) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:300) at org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:440) at org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:222) at org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:475) at org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:208) at org.apache.xpath.objects.XRTreeFragSelectWrapper.execute(XRTreeFragSelectWrapper.java:69) at org.apache.xpath.XPath.execute(XPath.java:337) at org.apache.xalan.templates.ElemVariable.getValue(ElemVariable.java:280) at org.apache.xalan.templates.ElemVariable.execute(ElemVariable.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemTemplate.execute(ElemTemplate.java:394) at org.apache.xalan.templates.ElemCallTemplate.execute(ElemCallTemplate.java:248) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:128) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376) at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:395) at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:178) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2402) at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2272) at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1358) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:711) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1275) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1253) at deister.axional.server.lang.xsl.XSLProcessor.__execute(XSLProcessor.java:862) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:699) at deister.axional.server.lang.xsl.XSLProcessor$4.call(XSLProcessor.java:691) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

3 Task Scripts

3.1 apps_sfa_task_assign.save

The script with the code apps_sfa_task_assign.save is executed when users modify an assignment from their device. The program must return a [true/false] boolean value.

Example: This script requires the user to indicate a reason when modifying an assignment date.

Example
Copy
// Indicate reason for assignment modification
import android.widget.Toast;

 
try{
     EditText    ed_ch_motive      = caller.get("assign_ch_reason").getEditText();
     String      ch_motive         = ed_ch_motive.getText().toString();
 
    if(ch_motive.equals("1")){
 
        Toast.makeText(context, "Indicate a Reason ", Toast.LENGTH_LONG).show(); 
        return false;
    }        
}catch (Exception ex) {
   System.err.println("Generating new manual assignment");
 
} 
 
return true;
Once the date has been modified, press the OK button. The system will check whether the script 'apps_sfa_task_assign.save' exists, then execute it. Because the reason is not indicated, the system displays an 'Indicate a Reason' message, and does not allow modifications to be performed.
Once a reason is indicated, press the OK button. The script will return a 'true', and the action can be performed.
The assignment has been transferred from day 13 to 16.
Pressing an assignment will bring up a system dialog, used modify the date, notes and a combo. The reason for modification must be indicated here.

3.2 apps_sfa_task_assign.validate

Task execution must be correct at every point to maintain logic. To minimize possible employee errors, certain scripts are used as in situ checkers of the information supplied by the employee.

These "scripts" help perform checks such as:

  • Avoid picking up or delivering more packages than stipulated.
  • Avoid picking up or delivering fewer packages than stipulated.
  • Avoid errors in which packages to pick up or deliver, etc.

When the script with the apps_sfa_task_assign.validate code is executed, the system performs an automatic check. The program must return a [true/false] boolean.

A set of functions intrinsic to the script can be used.

Set of functions intrinsic to the script which can be used:

Example
Copy
// ***********************
// Header Functions
// ***********************
 
/**
 * Obtain PK.
 * Example: int type = caller.getAssignType()
 *
 * Used for BSH caller Validate
 * @return
 */
 
public int getAssignType(){
    return m_assign_type;
}
 
/**
 * 
 * @return
 */
public int getAssignNumber(){
    return m_assign_number;
}
 
/**
 * 
 * @return
 */
 
public String getAssignUser(){
    return m_assign_user;
}
 
/**
 * Obtain assignment task code.
 * Example: String m_task_code = caller.getTaskCode()
 *
 * Used for BSH caller Validate
 * @return
 */
 
public String getTaskCode(){
    return m_task_code;
}
 
/**
 * Obtain assignment customer code.
 * Example: String m_assign_customer = caller.getSurveyCustomer()
 *
 * @return
 */
public String getSurveyCustomer()
{
    return m_assign_customer;
}
 
/**
 * Obtain assignment source code.
 * Example: String m_assign_docori = caller.getSurveyDocori()
 *
 * @return
 */
public String getSurveyDocori()
{
    return m_assign_docori;
}
 
// ***********************
// Question Functions
// ***********************
 
  /**
     * Obtain set of Object Questions in an Array.
     * Example: m_questions = caller.getQuestions();
     * Used for BSH caller Validate to interact with questions and their values
     * @return
     */
    public ArrayList<Question> getQuestions(){
 
        return m_questions;
    }
 
    // Example:
    // GET THE QUESTIONS
    m_questions = caller.getQuestions();
 
    // Navigate from question to question
    for (Question q : m_questions) {
        if (q.isVirtual())
            continue;
 
        String m_ask_code = q.getAskCode();
        String m_ask_text = q.getAskText();
    }
 
    * Public Methods
    * ==============
    *
    * void      lock()
    * void      unlock()
    * boolean   isLocked()
    *
    * String    toString()
    * void      setInputRequired(boolean required)
    *
    * void      setTextView(TextView text)
    * void      setImageView(ImageView image)
    * TextView  getTextView()
    * TextView  getLabelView()
    * boolean   isNull()
    * boolean   isVirtual()
    * boolean   isPrintable()
    * boolean   isBinary()
    * boolean   isRequired()
    * String    getGroupCode()
    * String    getTaskCode()
    * String    getAskCode()
    * int       getAskSeqno()
    * int       getAskType()
    * String    getAskCombo()
    * String    getAskText()
    * int       getIndex()
    * String    getValue()
    *
    * DATA SETTERS (Public)
    * ============
    * void      setValue(String value)
    * void      setInitialValue(String value)
    * void      setBytes(byte[] value)
    * void      setImageBytes(byte[] temp)
    * void      setImageBytes(Uri uri)
    * void      setPOSOrderIcon()

In this package delivery and pick-up example, the system will perform a final check if packages have been picked up and delivered. This will be executed through the script apps_sfa_task_assign.validate when the employee presses the End Task button.


Example
Copy
// Validate the Survey before closing.

import java.util.ArrayList;

import android.text.Html;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.Gravity;
import android.widget.Toast;
import android.net.Uri;
import android.util.Base64;
import android.database.Cursor;
import deister.android.apps.Constants;
import deister.android.apps.Config;

import deister.android.apps.modules.sfa.question.Question;

import deister.android.apps.R;

try{

    // GET THE TASK CODE
    String m_task_code = caller.getTaskCode();

    // GET ASSIGNMENT PK
    Integer m_type = Integer.valueOf(caller.getAssignType());
    Integer m_num  = Integer.valueOf(caller.getAssignNumber());
    String m_user  = caller.getAssignUser();

    // GET QUESTIONS
    m_questions = caller.getQuestions();


    // Monthly operations (manual)
    if(m_task_code.equals("DELIVERY")){

        String m_livre="";

        m_livre = m_questions.get(2).getValue();

        //for(idx=1;idx<m_questions.size();idx++){
        //    if(m_questions.get(idx).getAskCode().equals("delivery.livre")){
        //        m_livre = m_questions.get(idx).getValue();
        //    }
        //}

        Integer m_num_bul      = 0;
        Integer m_num_bul_read = 0;

        //PACKAGES IN ASSIGNMENT
        Cursor cur_bult = context.getContentResolver().query(
            Constants.tableUri(Constants.tableOf(Constants.TABLE_SFA_TASK_ASSIGN_EANS)),
            new String[] {"*"},
            " assign_user= ? AND assign_type= ? AND assign_number= ? ",
            new String[] {m_user,String.valueOf(m_type),String.valueOf(m_num)},
            null
        );

        while (cur_bult.moveToNext()) {
            m_num_bul = m_num_bul +1;
        }

        cur_bult.close();

        //PACKAGES SCANNED
        Cursor cur_bult_read = context.getContentResolver().query(
            Constants.tableUri(Constants.tableOf(Constants.TABLE_SFA_TASK_RESL_EANS)),
            new String[] {"*"},
            " assign_user= ? AND assign_type= ? AND assign_number= ? ",
            new String[] {m_user,String.valueOf(m_type),String.valueOf(m_num)},
            null
        );

        while (cur_bult_read.moveToNext()) {
            m_num_bul_read = m_num_bul_read +1;
        }

        cur_bult_read.close();

        if(m_livre.equals("Oui")){

            if(m_num_bul > m_num_bul_read){

                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setIcon(R.drawable.alert_warning);
                alertDialog.setTitle(Html.fromHtml("<font color='#FF0000'><b>Livraison incomplète!!!</font>"));
                alertDialog.setMessage(Html.fromHtml("<font color='#58FA58'>PAQUETS À LIVRER:"+ m_num_bul +"<br/><br/>PAQUETS LIVRÉS:"+ m_num_bul_read));
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                alertDialog.show();

                return false;
            }
        }

        if(m_livre.equals("Partiel")){

            if(m_num_bul_read == 0){

                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setIcon(R.drawable.alert_warning);
                alertDialog.setTitle(Html.fromHtml("<font color='#FF0000'><b>Livraison partielle!!!</font>"));
                alertDialog.setMessage(Html.fromHtml("<font color='#58FA58'>PAQUETS À LIVRER:"+ m_num_bul +"<br/><br/>PAQUETS LIVRÉS:"+ m_num_bul_read));
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                alertDialog.show();

                return false;
            }
        }
    }

    // Monthly operations (manual)
    if(m_task_code.equals("PICKUP")){

        String m_collecte="";

        m_collecte = m_questions.get(2).getValue();

        //for(idx=1;idx<m_questions.size();idx++){
        //    if(m_questions.get(idx).getAskCode().equals("delivery.livre")){
        //        m_livre = m_questions.get(idx).getValue();
        //    }
        //}

        Integer m_num_bul      = 0;
        Integer m_num_bul_read = 0;

        //PACKAGES IN ASSIGNMENT
        Cursor cur_bult = context.getContentResolver().query(
            Constants.tableUri(Constants.tableOf(Constants.TABLE_SFA_TASK_ASSIGN_EANS)),
            new String[] {"*"},
            " assign_user= ? AND assign_type= ? AND assign_number= ? ",
            new String[] {m_user,String.valueOf(m_type),String.valueOf(m_num)},
            null
        );

        while (cur_bult.moveToNext()) {
            m_num_bul = m_num_bul +1;
        }

        cur_bult.close();

        //PACKAGES READ
        Cursor cur_bult_read = context.getContentResolver().query(
            Constants.tableUri(Constants.tableOf(Constants.TABLE_SFA_TASK_RESL_EANS)),
            new String[] {"*"},
            " assign_user= ? AND assign_type= ? AND assign_number= ? ",
            new String[] {m_user,String.valueOf(m_type),String.valueOf(m_num)},
            null
        );

        while (cur_bult_read.moveToNext()) {
            m_num_bul_read = m_num_bul_read +1;
        }

        cur_bult_read.close();

        if(m_collecte.equals("Oui")){

            if(m_num_bul > m_num_bul_read){

                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setIcon(R.drawable.alert_warning);
                alertDialog.setTitle(Html.fromHtml("<font color='#FF0000'><b>Collecté incomplete!!!</font>"));
                alertDialog.setMessage(Html.fromHtml("<font color='#58FA58'>PAQUETS POUR RECUEILLIR:"+ m_num_bul +"<br/><br/>PAQUETS COLLECTÉS:"+ m_num_bul_read));
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                alertDialog.show();

                return false;
            }
        }

        if(m_collecte.equals("Partiel")){

            if(m_num_bul_read == 0){

                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setIcon(R.drawable.alert_warning);
                alertDialog.setTitle(Html.fromHtml("<font color='#FF0000'><b>Collecté partielle!!!</font>"));
                alertDialog.setMessage(Html.fromHtml("<font color='#58FA58'>PAQUETS POUR RECUEILLIR:"+ m_num_bul +"<br/><br/>PAQUETS COLLECTÉS:"+ m_num_bul_read));
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                alertDialog.show();

                return false;
            }
        

            if(m_num_bul_read == m_num_bul){

                AlertDialog alertDialog = new AlertDialog.Builder(context).create();
                alertDialog.setIcon(R.drawable.alert_warning);
                alertDialog.setTitle(Html.fromHtml("<font color='#FF0000'><b>Livraison non partielle!!!</font>"));
                alertDialog.setMessage(Html.fromHtml("<font color='#58FA58'>PAQUETS POUR RECUEILLIR:"+ m_num_bul +"<br/><br/>PAQUETS COLLECTÉS:"+ m_num_bul_read));
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                    }
                });

                alertDialog.show();

                return false;
            }
        
        }
}catch (Exception ex) {
   Toast.makeText(context, "Trying to Validate, but an error ocurred", Toast.LENGTH_LONG).show();
}

return true;
Automatic Incomplete Delivery Validator
Automatic Incomplete Pickup Validator

Example: Task where the user must indicate electronic meter readings. This script checks that the value read and reported by the user is higher than the last value read. After checkout, the consum field (response) is set to the values subtracted.

Example
Copy
// Validate Survey before closing.
 
import java.util.Date;
import java.util.ArrayList;
 
import android.widget.Toast;
 
import deister.android.apps.modules.sfa.question.Question;
 
 
 
try{
    // GET TASK CODE
    String m_task_code = caller.getTaskCode();
 
    // GET QUESTIONS
    m_questions = caller.getQuestions();
 
 
    // Monthly operations (manual)
    if(m_task_code.equals("1-049")){
 
 
            // SURVEY QUESTIONS
            //
            // ask_code       Type           Text
            // -----------------------------------------------------------------
            // PR_1         No-entry         Kilometros
            // PR_2         Timestamp        Dietas
            // -----------------------------------------------------------------
            Integer  m_pr_1 = Integer.valueOf(m_questions.get(0).getValue());
 
 
            // Check that the kilometers value is above 10
            if(m_pr_1 < 10){
                Toast.makeText(context, "Insufficient km", Toast.LENGTH_LONG).show();
                return false;
            } 
    }
 
}catch (Exception ex) {
    Toast.makeText(context, "Trying to Validate, but an error occurred", Toast.LENGTH_LONG).show();
}
 
return true;
After pressing the assignment close button and verifying the script, the form will show any errors which the script returned.