Adding values lists as lookups to fields

Some fields in a mobile app have value lists, or domains, from which users can select a value. You add a value list as a lookup in a field in the app.xmlfile.

Before you begin

Add the field that you want to associate the lookup of values with to the mobile app.

Run the Resource Description Framework (RDF) puller to import Open Services for Lifecycle Collaboration (OSLC) resources into Maximo Anywhere.

Maximo Anywhere includes OSLC resources for synonym domains and alphanumeric (ALN) domains. Verify that the OSLC resource is provided in Maximo Anywhere for the type of domain that you are adding. You can also create resources for a domain in Maximo Asset Management and import them into Maximo Anywhere.

About this task

To add a value list to a field, you add the value list as a resource and create a lookup for that resource. You can then add the resource and the lookup to the view for the field.

Procedure

  1. In Eclipse, open the app.xml file for the mobile app that you want to update. The app.xml file is located in the Anywhere\MaximoAnywhere\apps\app_name\artifact directory.
  2. In the Data Definition section, add the resource data for the value list.

    For example, to add a value list to the field named Risk on the Work Order Details view of the Technician app, add the resource data for the domain named RISKDOMAIN to the data section of the app.xml file. RISK_DOMAIN is an ALN domain and has the values of high, medium, and low.

    <!-- RISK DOMAIN -->
    <resource providedBy="/oslc/sp/SmarterPhysicalInfrastructure"
    describedBy="http://jazz.net/ns/ism/asset/smarter_physical_infrastructure#AlphaNumericDomain"
    	name="riskDomain" pageSize="10" additionalData="true">
    	<attributes>
    		<attribute name="value" describedByProperty="spi:value" />
    		<attribute name="domainid" describedByProperty="spi:domainid"/>
    		<attribute name="alndomainid" describedByProperty="spi:alndomainid"/>
    		<attribute name="description" describedByProperty="spi:description" />
    	</attributes>
    	<queryBases>
    		<queryBase name="getRisk" queryUri="/oslc/os/oslcalndomain" />
    	</queryBases>
    	<whereClause clause="spi:domainid='RISKDOMAIN'" />
    </resource>
  3. In the UI section, create the lookup data for the value list and associate the resource with the lookup.
    For example, add the lookup for the RISK DOMAIN resource.
    <!-- Risk Domain Lookup -->
    <lookup id="WorkExecution.RiskLookup" label="Select Risk"
    		resource="riskDomain" >
    	<requiredResources>
    		<requiredResource name="riskDomain"/>
    	</requiredResources>
    	<list resource="riskDomain">
    		<listItemTemplate layout="Item1Desc1">
    				<listtext resourceAttribute="value" layoutInsertAt="item1"
    					cssClass="bold textappearance-medium"/>
    				<listtext resourceAttribute="description" layoutInsertAt="desc1"
    						cssClass="bold textappearance-medium"/>
    		</listItemTemplate>
    	</list>
    	<returnAttributes>
    		<returnAttribute sourceAttribute="value" targetAttribute="risk" />
    	</returnAttributes>
    </lookup>
  4. In the UI section, associate the new lookup with the field.
    1. On the Design tab, find the <view> element for the field that you want to add the lookup to.
    2. On the Source tab, add the lookup to the <group item> element within the view that you are updating.
    For example, associate the risk domain lookup with the Work Order Details view.
    <view id="WorkExecution.WorkDetailView" label="Work Order Details" 
    	resource="workOrder" >
    	<...>
    	<container resource="workOrder">
    	<...>
    		<groupitem>
    			<text resourceAttribute="risk" label="Risk"
    					editable="true" lookup="WorkExecution.RiskLookup"
    					lookupAttribute="risk" placeHolder="Tap to enter" />
    		</groupitem>
    	<...>
    </view>		
  5. Save your changes.
    The application builds automatically.
  6. Optional: To preview and test your changes in a mobile simulator, right-click on the application folder and select Run As > Preview.

What to do next

Build and deploy the app.