Service Optimization Form Expressions Product ClickApp by ClickSoftware For use with ClickMobile Touch ClickSoftware Confidential Legal Notice The software with this guide is furnished under a license agreement and may be used only according to the terms of that agreement. Copyright Copyright © ClickSoftware Technologies Ltd. All rights reserved. No part of this publication may be copied without the express written permission of ClickSoftware Technologies Ltd. Patent and Trademark US Patent Number 6,985,872 B2 ClickAnalyze, ClickFix, ClickForecast, ClickMobile, ClickPlan, ClickRoster, ClickSchedule, and ClickSoftware are registered trademarks of ClickSoftware Technologies Ltd. Contact Information Contact information is available from the ClickSoftware web site: http://www.clicksoftware.com. For general information, email to sales@clicksoftware.com. For ClickSoftware Worldwide Support, email to support@clicksoftware.com or see the support page on the ClickSoftware web site. For Partner Enablement, email to partnerenablement@clicksoftware.com. Publication Notice This guide has been carefully compiled. The information in this guide does not constitute a warranty of performance. Furthermore, ClickSoftware reserves the right to revise this publication and make changes from time to time in the content thereof, without obligation to notify any person of such revisions or changes. ClickSoftware assumes no liability for losses incurred as a result of out-of-date or incorrect information in this guide. Version Form Expressions App number: 1171 App version: 2.0.0.3 Date: January 2014 Form Expressions 3 Contents FORM EXPRESSIONS ................................... 4 Use ............................................................................................................. 5 Prerequisites .............................................................................................. 6 Installation .................................................................................................. 7 Configuration .............................................................................................. 7 Enabling the Form Expression Event ................................................... 7 Defining Expressions ............................................................................ 8 Comments ................................................................................................ 11 4 Form Expressions Form Expressions This app enables an implementer to change the behavior of a ClickMobile Touch form dynamically. The implementer can enable or disable a form control, or make a control optional or mandatory, depending on the properties of the object that the form displays. Form Expressions 5 Use Each property control on a ClickMobile form has the following attributes: Mandatory If true, the property must have a value. If the value is blank, the user cannot save the form data. To indicate this, ClickMobile displays a red asterisk next to the control. 6 Form Expressions If false, the property can have a value or it can be blank. ClickMobile displays the control without the asterisk. EnabledControl If true, the property is read/write. A user can enter or edit a property value. ClickMobile displays the control in black. If false, the property is read-only. The user cannot enter or edit the value. ClickMobile displays the control in gray. The Form Expression app enables you to associate an expression with the Mandatory or EnabledControl attributes. If the expression is true, Mandatory or EnabledControl is true. If the expression is false, Mandatory or EnabledControl is false. For example, your organization might require that when an engineer completes a plumbing or electricity task, the engineer must enter a value in a task property called BillingRate. You can ensure this in the following way: 1. On the ClickMobile assignment form, display the Task.BillingRate property. 2. Associate an expression with the Mandatory attribute of the BillingRate control. 3. Configure the expression: Task.Type IsOneOf (Plumbing, Electricity) and Task.Status IsOneOf (Complete) When the expression is true, ClickMobile makes the BillingRate control mandatory. If the value of BillingRate is blank, the user cannot save the assignment form. Prerequisites This app runs on ClickMobile Touch. For information about the certified versions, see the ClickSoftware AppStore page of this app. Note: Starting in version 8.1.10 Patch 3, the ClickMobile Touch form editor offers an enhanced form-expression capability. The capability is out-ofthe-box and does not require this app. For information, see the ClickMobile Configuration Guide. Form Expressions 7 Installation 1. On each computer where you run the ClickMobile middle tier, copy the following files to the ClickMobileWEB\CustomScripts directory: FormExpressions.js FormExpressionsResources.js If you are installing a localized version of the app, you must install certain files in a locale subdirectory of the above location. For instructions, see Localizing ClickMobile in the Service Optimization Localization Guide. 2. On each computer where you run the Mobility Studio, copy the following files to the Service Optimization\Bin directory: FormExpressionsAdminUI.dll Microsoft.VisualBasic.PowerPacks.Vs.dll Note: If you have a copy of Microsoft.VisualBasic.PowerPacks.Vs.dll in C:\Windows\assembly, you do not have to install it in Service Optimization\Bin, but it does no harm to do so. Configuration To configure the Form Expressions app, you must perform the following main steps: 1. Enable a form expression event. 2. Define the expressions for the Mandatory and EnabledControl attributes of property controls. The following sections provide details of these steps. The instructions are for ClickMobile version 8.1.9. The instructions might vary slightly for other versions. Enabling the Form Expression Event You must configure a ClickMobile client event: 1. In the Mobility Studio, edit the ClickMobile Touch user template. 2. From the toolbox, drag an Event component to the miscellaneous pane, under the client display. 3. Configure the following attributes of the event. 8 Form Expressions Name Enter a name such as Form Expressions. App ID Enter the JS file name FormExpressions.js. Enter the class name CAF.FormExpressions.Main. App Admin ID Browse to the DLL name FormExpressionsAdminUI.dll. Select the class name FormExpressionsAdmin. 4. Click Apply. This saves the event configuration. Defining Expressions To define an expression, perform the following steps. We illustrate the procedure with the BillingRate example, described in the Use section above. 1. In the Mobility Studio, edit the ClickMobile Touch user template. 2. Select the Form Expressions event. 3. On the Properties tab, edit the App Settings attribute of the event. This opens a configuration window. Form Expressions 4. 9 In the Source Object dropdown, select the form type. In the BillingRate example, select Assignment. The configuration window displays the expressions that you have already configured for the assignment form. To display the expressions of all forms, click the Show All Expressions button. 5. Click the Add button to define a new expression, or Edit to revise an existing expression. 6. At the top of the expression editor, configure the following options: Target Object Target Property Select the object and the property control that you want to associate with an expression, such as Task.BillingRate. Attribute The attribute of the property control that you want to associate with an expression. You can select the Mandatory or EnabledControl attribute. In the BillingRate example, select Mandatory. 7. In the bottom section of the expression editor, click Add Expression and configure the first expression line: 10 Form Expressions Task.Type IsOneOf (Plumbing, Electricity) 8. Click the Add Operator button and select the AND option, meaning that the expression is true only if both lines are true. If you select OR, the expression is true if any line is true. 9. Click Add Expression and configure the second line: Task.Status IsOneOf (Complete) For more complex expressions, you can click the buttons to add parentheses and to move the expression lines up or down. 10. Click OK and close the expression editor. 11. Click Apply and close the Mobility Studio. Expression Details In the Source Object column of an expression row, select the object to which a property belongs. For example, if you are configuring an expression for the assignment form, you can select the Assignment object or the Task object. In the Source Property column, select a dictionary, string, or boolean property of the Source Object. Form Expressions If you select a dictionary property such as Task.Type or Task.Status, you can select the following operators: IsOneOf IsNotOneOf In the Value column, click the browse button and select the dictionary items. If you select a string property, you can select the following operators: IsEmpty IsNotEmpty In the Value column, make no entries. If you select a boolean property, you can select the following operators: IsTrue IsNotTrue In the Value column, make no entries. Comments The ClickMobile appearance is configurable. The layout might differ on your device. 11