Maximo

 View Only

 setQBE on rel.object{attribute}

Jump to  Best Answer
guillaume munger's profile image
guillaume munger posted Mon March 16, 2026 02:32 PM

Hi,
I am trying to perform a setQBE on an attribute that exists inside a rel.object{attribute} relationship, but I am not sure how to correctly reference it.

the attribute look like this 

      <attribute id="am36b7" name="rel.classstructure{description_class--locclassdescription}"/>

I have already attempted several approaches, such as:

  •         dsLocation.setQBE("classstructure[0].locclassdescription", "=", "Phase bâtiment")
  •         dsLocation.setQBE("locclassdescription", "=", "Phase bâtiment")
  •         dsLocation.setQBE("classstructure.locclassdescription", "=", "Phase bâtiment")

However, none of them have worked so far.

Could you please advise on the correct way to apply a QBE filter on an attribute that comes from a related object?

Thank you.

Steven Shull's profile image
Steven Shull IBM Champion  Best Answer

Sorry, I didn't even bother to look if this was a persistent attribute or not. You are correct. The oslc.where is used to build a SQL where clause that gets executed against the database so it must be a persistent attribute to work, similar to core Maximo UI functionality. 

Bartosz Marchewka's profile image
Bartosz Marchewka IBM Champion

Hi @guillaume munger,

For RBA you can try to use classstructure.description_class but I think it will not work for real device. Even IBM implements QBE differently here for Mobile and RBA 

(could you please review an existing IBM code in SRMOBILE application).

app.xml

<maximo-datasource id="allcategoryds" object-structure="mxapitkclass" offline-immediate-download="true" lookup-data="true" saved-query="MOBILECLASSSTRUCTURE" selection-mode="single" order-by="sortorder" controller="CategoryDataController" page-size="15" can-load="{app.state.isMobileContainer||app.state.canLoad.categories}">
    <schema id="aqpwv">
      (...)
      <attribute name="rel.classusewith{objectname}" id="en5e2"/>
      <attribute name="classusewithsr" id="r_e2k">
        <attribute name="_exists--usewithsr" index="true" id="d7re7"/>
      </attribute>
      (...)
  </maximo-datasource>

CategoryCommonController:loadCategoryDS()

(...)
            //istanbul ignore next
            if (this.app.state.isMobileContainer) {
                categoryDS.setQBE('usewithsr', true);
            } else if (!this.app.client.fakeClient) {
                //Attribute inside relationship does not work for device
                categoryDS.setQBE('classusewith.objectname', '=', 'SR');
            }
(...)

Steven Shull's profile image
Steven Shull IBM Champion

Bartosz is correct. Expanding why this is different between mobile and web, in web scenario, the QBE is passed into the REST API's oslc.where. This has a specific notation required of relationship.attributename (IBM Maximo REST API Guide – Filtering). NOTE: This is not to be confused with child object filtering in the REST API which is a bit different. 

In mobile, the QBE is executed against the sqlite database. Currently for anything to be searchable in Maximo Mobile, it must be part of the top-level object. IE if you're on WORKORDER, you can only search attributes directly on WORKORDER (or aliased, which I'll explain in a second). Child objects and relationships in the REST API will normally return as a JSON object or JSON array inside the main body and would thus not be searchable in Maximo Mobile. However, the alias for description_class changes the REST API response to move it up a level as locclassdescription. From a mobile perspective, this enables it to function as if it was part of the main object in this case and thus be searchable. But it's stored as locclassdescription and doesn't know what the old relationship and attribute used to be. The alias feature can only go up a single level so if you had a third level object (IE WORKORDER->MULTIASSETLOCCI->ASSET), you would NOT be able to search this today using the setQBE on Maximo Mobile but would be able in the web role-based applications. 

guillaume munger's profile image
guillaume munger

Hi Bartosz and Steven,

Thank you both for the detailed explanations. Your comments helped clarify the distinction between how QBE works in RBA (through oslc.where) versus Maximo Mobile (SQLite-level filtering on top‑level or aliased attributes).

I just want to confirm how I should apply this to my specific case.

In my object structure, I have:

<attribute id="am36b7" name="rel.classstructure{description_class--locclassdescription}"/>

From Steven’s explanation, my understanding is that on Mobile, the alias (--locclassdescription) moves the value up to the top level, and only the aliased name is available for QBE filtering.

If that is correct, then on the device I should be able to use:

dsLocation.setQBE("locclassdescription", "=", "Phase bâtiment");

And relationship-style syntax such as:

dsLocation.setQBE("classstructure.description_class", "=", ...);
dsLocation.setQBE("classstructure.locclassdescription", "=", ...);

would not work on the device because the relationship does not exist in SQLite.

Could you please confirm that the correct Mobile usage in my case is simply:

dsLocation.setQBE("locclassdescription", "=", "Phase bâtiment");
And that there is no supported way to reference classstructure.description_class or the original relationship path on Mobile?

Thank you again for the clarity — I just want to be sure I’m applying the aliasing behavior correctly in my implementation.

Steven Shull's profile image
Steven Shull IBM Champion

Mobile:

dsLocation.setQBE("locclassdescription", "=", "Phase bâtiment");


Web:

dsLocation.setQBE("classstructure.description_class", "=", ...);


Since Maximo Mobile apps are available in both web and mobile and when you test it in the MAF configuration utility it is a web app, you should handle both scenarios similar to the example Bartosz mentioned. 

guillaume munger's profile image
guillaume munger

Hi Steven,

Thanks again for the guidance on handling Mobile vs. Web.

One follow‑up: in my object structure I’m pulling

rel.classstructure{description_class--locclassdescription}
description_class on CLASSSTRUCTURE is a non‑persistent attribute. In the Web (MAF config utility) scenario, when I try:
dsLocation.setQBE("classstructure.description_class", "=", "Phase bâtiment");

I get an error: “failed to load query.”

Could the fact that description_class is non‑persistent be the reason this REST filter fails on Web—even though it’s included in the object structure—because the API can’t evaluate a where clause against a non‑persistent field?

Just want to confirm if that limitation would explain the “failed to load query” error I’m seeing.