Maximo Open Forum

 View Only
Expand all | Collapse all

Is it not possible to query data sources using the WHERE clause on mobile devices using the Maximo mobile app?

  • 1.  Is it not possible to query data sources using the WHERE clause on mobile devices using the Maximo mobile app?

    Posted 5 days ago

    Hello.

    I am currently developing the Maximo mobile app (MAF App).

    I created the page controller and executed the relevant method, but it seems that the query is not working with the WHERE clause.

    The functionality I want is to retrieve both the fromdate and todate for the 'tagstartdate' column in a single query to retrieve data between the fromdate and todate.

    It appears that using setqbe only satisfies one of the two conditions: querying by fromdate or querying by todate. I would appreciate your suggestions on how to resolve this.

    Also, could you explain how the web and mobile differ so that a feature that works on the web does not work on mobile devices?

    Thank you.

    ------------------------------------

       async testWorkSearch(e){
            const fromdate = this.dateFormat(new Date());
            const todate = this.dateFormat(new Date());

            const dateWhere = `targetstartdate>="${fromdate}" and targetstartdate<="${todate}"`;

            await this.listDS.load({
                noCache: true,
                where: dateWhere
            });
        }


    #MaximoApplicationSuite

    ------------------------------
    GeunYoung Ahn
    Visionic
    ------------------------------


  • 2.  RE: Is it not possible to query data sources using the WHERE clause on mobile devices using the Maximo mobile app?

    Posted 5 days ago
    GYA,
    If you need guaranteed server hits, consider mobile-server-search="true" on the datasource (limits to page size) + proper QBE. But this reduces offline capability.
    The mobile-server-search="true" option (introduced/enhanced in Maximo Mobile 9.0) is specifically designed for cases like yours - where you need dynamic, runtime server-side queries (e.g., a custom date range WHERE clause that isn't feasible with pre-synced local data or simple QBE).
    You add that option via a data source override in your page's XML definition (NOT directly on the main <maximo-datasource> in most cases).
    Here is the XML:
    <maximo-datasource id="listDS" 
                       object-structure="..." 
                       saved-query="..." 
                       pre-load="false"   <!-- often used with this feature -->
                       ... >
        <!-- your schema attributes here -->
        
        <!-- Override for server-side behavior -->
        <maximo-datasource-override id="serverSearch" 
                                    mobile-server-search="true" 
                                    page-size="20" />   <!-- adjust as needed; common values 5–20 -->
    </maximo-datasource>

    Then run your script from Maximo as you have it written. 
    
    
    
    
    - the framework will now route the query to the Maximo server instead of the local SQLite DB (when the device is online).
    Play with it!
    Hope this helps


    ------------------------------
    CHARLES LAMB
    Bay Area Rapid Transit
    ------------------------------