Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  mobile-qbe-filter Syntax in Maximo Mobile

    Posted Mon April 13, 2026 08:44 AM

    Hello there,

    In my TECHMOBILE app.xml, I have a data source defined as below.

    <maximo-datasource-override default="false" id="assignedPmWoDS" mobile-qbe-filter="{{'status_maxvalue': '!=COMP,CAN,CLOSE', 'assignment[0].status_maxvalue' : '!=COMPLETE'}}" saved-query="assignedPMWorkorders"/>   

    It's currently displaying the assignments that are not in COMPLETE status. But, I also have a scenario where Work Order won't have any assignment and in that case this condition results in false and WO isn't listed. 

    I am not familiar with the mobile-qbe-filter syntax. What I need logically is defined below. 

    status NOT IN (COMP,CAN,CLOSE)
    AND (
            no assignment exists
            OR first assignment status NOT IN (COMPLETE)
        )

    Any help on this?

    Other option I will try to achive this using a computed function.



    ------------------------------
    Sourabh
    ------------------------------


  • 2.  RE: mobile-qbe-filter Syntax in Maximo Mobile

    Posted Tue April 14, 2026 05:16 AM

    Hi @Sourabh Jain

    Have you considered extending the Query Clause for the assignedPMWorkorders saved query definition in MAS Manage, rather than using mobile-qbe-filter?



    ------------------------------
    Bartosz Marchewka
    IBM Maximo Consultant
    AFRY
    ------------------------------



  • 3.  RE: mobile-qbe-filter Syntax in Maximo Mobile

    Posted Thu April 16, 2026 03:49 AM
    Edited by Sourabh Jain Thu April 16, 2026 03:56 AM

    Hi Bartosz,

    I’m working on filtering records for the mobile device and have run into a limitation with the mobile-qbe-filter.

    The Scenario: I have a Work Order with multiple assignments (e.g., two assignments for LABOR-X). Currently, I am using the condition assignment[0].status_maxvalue.

    The Issue:

    • If a Work Order has two assignments and only one is marked as COMPLETE, the Work Order is excluded from the dropdown list because the filter only evaluates the first element of the array ([0]).
    • On mobile, we don't change the Work Order status directly. We complete the assignments instead. We need the Work Order to remain visible until all relevant assignments are handled, or be excluded only when specific criteria across the array are met.

    Since the standard QBE filter seems limited to single-index checks, I am considering using onAfterLoadData within appCustomizations to implement the business logic and filter the records programmatically.


    ------------------------------
    Sourabh
    ------------------------------



  • 4.  RE: mobile-qbe-filter Syntax in Maximo Mobile

    Posted Thu April 23, 2026 01:10 PM

    Since we have less control over which record assignment[0] may have, I think doing programmatically in onAfterLoadData is good option here. We have done something similar where we replaced the UI to use Json data source and then update the Json data source on onAfterLoadData. Below is sample script if that helps at all, similar to what we have created:

    async onAfterLoadData(dataSource, items) {
    if (dataSource && dataSource.name === "assignedPMWorkorders") {
          console.log("Entering AppCustomizations.onAfterLoadData for assignedPMWorkorders");
    
          let workorderDisplayData = [];
          let obj = {};
          let cus_activeassignments = [];
          
          //
          // find the datasouce cus_dswolist_json_ds and read the attributes defined.
          //
          let cus_dswolist_json_ds = this.app.findDatasource("cus_dswolist_json_ds");
          let json_attributes = cus_dswolist_json_ds.baseQuery.select.split(',');
    
          //
          //  Ensure we have at least one record
          // 'items' referenced below is the the rows in assignedPMWorkorders datasouce.
          //
          if (items && items.length > 0) {
            //
            //for each row in assignedPMWorkorders datasource, iterate
            //
            items.forEach((record) => {
              //
              // Check how many active assignments are there for this record (WO/Task)
              // and set it to cus_activeassignmentcount.  We only want to show
              // WO/Task with atleast one active assignments in List view. Below logic
              // makes sure the app behaves properly even when users are not in 
              // network and have one or multiple assignments that they complete.
              //
    
              if (record.assignment) {
                cus_activeassignments = record.assignment.filter(s => s.status_maxvalue != 'COMPLETE')
    
                if (cus_activeassignments.length > 0) {
    
                  //
                  // for each attribute defined in json datasouce cus_dswolist_json_ds, make a copy of value in obj dictionary if found in assignedPMWorkorders
                  //
                  json_attributes.forEach((element) => {
    
                    //console.log("element " + element + " " + record[element]);
                    obj[element] = record[element];
                  })
    
                }
              }
              //
              // save data from obj dictionary into workorderDisplayData array
              //
    
              if (Object.keys(obj).length != 0) {
                workorderDisplayData.push(obj);
              }
              //
              // Empty Obj dictionary to process next row from  assignedPMWorkorders datasource
              //
              obj = {};
            })
          }
          //
          // load the data created above onto cus_dswolist_json_ds datasource to display in UI
          //
          await cus_dswolist_json_ds.load({
            src: workorderDisplayData,
            noCache: true
          });
          console.log("Exiting AppCustomizations.onAfterLoadData for assignedPMWorkorders");
        }
      }



    ------------------------------
    Prajesh (PJ)
    ------------------------------



  • 5.  RE: mobile-qbe-filter Syntax in Maximo Mobile

    Posted Thu April 23, 2026 08:37 PM

    Thanks PJ. I tried few things using onAfterLoadData and JSON data source but being a schedule page datasource is making it complex. 

    Was your requirement also for the Schedule page datasource?

    I have used JSON data sources for other pages a number of times successfully.



    ------------------------------
    Sourabh
    ------------------------------



  • 6.  RE: mobile-qbe-filter Syntax in Maximo Mobile

    Posted Fri April 24, 2026 10:44 PM

    Hi Sourabh, 

    Yes, our requirement was on Schedule page too, but we have other customization also around there and it works for our use case. May be try below and see if it works in your case. 

    1. Add a mobile-only attribute on the main maximo-datasource for assignedPmWoDS , let's say hasopenassignment

    <attribute id="hasopenassignment_id" name="hasopenassignment"/
    2. Set hasopenassignment on onAfterLoadData of assignedPmWoDS. Similar logic as above code snippet, instead of loading json datasource, just set, assignedPmWoDS.item.hasopenassignment attribute to something. let's say 'YES' or 'NO'
    assignedPmWoDS.item.hasopenassignment= 'YES' ;
    3. add hasopenassignment to assignedPmWoDS's mobile-qbe-filter.
    mobile-qbe-filter="{{'status_maxvalue': '!=COMP,CAN,CLOSE', 'hasopenassignment': '=YES'}}"



    ------------------------------
    Prajesh (PJ)
    ------------------------------