I'm glad I was able to move forward with this customization thanks to your insights. To address your point - the searchable="true"
flag is already set on the custom attribute bgtype
, but unfortunately it's still not returning results when applying the QBE filter.
Original Message:
Sent: Tue May 27, 2025 10:03 AM
From: Bartosz Marchewka
Subject: SRMOBILE Location lookup
Hi @Mostafa Mosaad
I'm glad that I could help you to move forward with this customisation. If may I suggest, please:
- review if your solution is properly working in real Mobile Device as well in Role Based Applications (RBA). For some reasons IBM is building QBE in a different way when the flag
this.page.state.isMobileContainer
is set to False - consider to move your variable
lastCategory
to the app state section (add it to app.xml maximo-application -> states -> state) and manipulate it in the same way how IBM is doing for other states (for example topcategorydesc
).
If it comes to your question about locationLookupDS
don't know why it's not working. Maybe you can try to set property searchable=
"true"
for your custom attribute and check if this helped.
------------------------------
Bartosz Marchewka
IBM Maximo Consultant
AFRY
Original Message:
Sent: Tue May 27, 2025 08:06 AM
From: Mostafa Mosaad
Subject: SRMOBILE Location lookup
Hi Bartosz,
Thank you so much for your initial code - it really helped me get started and led me toward achieving the desired functionality. I used your code as a solid foundation and built upon it until I reached this working version:
I faced a couple of issues along the way - like the oslc.where
from the backend interfering with my QBE filters, which initially returned empty results. I realized I had to call clearQBE()
first to avoid conflicting filters.
Another issue was the filter persisting even after I changed categories. Adding a lastCategory
check helped avoid unnecessary reloads when the same category is selected again.
I'd really appreciate your feedback as someone more experienced with this.
Also, I have been trying to filter by a custom attribute on the location object, i made sure it is not excluded in the mxapioperloc object structure, also i added it as an attribute in the locationLookupDS Data source with no luck, do you have any idea why is this happening ?
Thanks again for your help - your starting point made a huge difference!
------------------------------
Mostafa Mosaad
Software Engineer
Megasoft
Cairo
01117275779
Original Message:
Sent: Mon May 26, 2025 05:22 AM
From: Bartosz Marchewka
Subject: SRMOBILE Location lookup
Hi @Mostafa Mosaad
If you can't customise java script mentioned above then I think you could add async
onBeforeLoadData(datasource, query)
method into AppCustomizations.js
Please don't treat the code below as final one, but as an idea how to do that:
class AppCustomizations { applicationInitialized(page, app) { this.app = app; this.page = page; } async onBeforeLoadData(datasource, query) { if(datasource.name === 'locationHierarchyDS') { let category = this.page.state.topcategorydesc; if(category === "OM" || category === "SOFT") { if (this.page.state.isMobileContainer && !datasource.lastQuery.qbe['type']){ datasource.setQBE("type", "=", "Branch"); await datasource.searchQBE(); datasource.forceReload(); } else if(!this.page.state.isMobileContainer && !datasource.lastQuery.qbe['LOCHIERLOCONLY.type']) { datasource.setQBE("LOCHIERLOCONLY.type", "=", "Branch"); await datasource.searchQBE(); datasource.forceReload(); } //FIXME: For ATM } } }}
------------------------------
Bartosz Marchewka
IBM Maximo Consultant
AFRY
Original Message:
Sent: Mon May 26, 2025 03:36 AM
From: Mostafa Mosaad
Subject: SRMOBILE Location lookup
if there are no workaround but adjusting the above function would it be something like this if am assuming correctly
async drillInLocation(item) {
let ds = this.page.datasources["locationHierarchyDS"];
ds.initializeQbe();
if (ds.lastQuery) {
ds.lastQuery.searchText = "";
}
let category = this.app.state.topcategorydesc;
if (this.app.state.isMobileContainer) {
if (item) {
ds.setQBE("parent", "=", item.location);
ds.setQBE("primarysystem", true);
ds.setQBE("systemid", "=", item.systemid);
} else {
ds.setQBE("parent", "!=", "*");
ds.setQBE("primarysystem", true);
}
} else {
if (item) {
ds.setQBE("LOCHIERLOCONLY.parent", "=", item.location);
} else {
ds.setQBE("LOCHIERLOCONLY.parent", "=", "null");
}
ds.setQBE("LOCHIERLOCONLY.LOCSYSTEM.primarysystem", "=true");
}
if (category === "OM" || category === "SOFT") {
ds.setQBE("LOCHIERLOCONLY.type", "=", "Branch");
} else if (category === "ATM") {
ds.setQBE("LOCHIERLOCONLY.type", "=", "ATM");
}
await ds.searchQBE();
}
------------------------------
Mostafa Mosaad
Software Engineer
Megasoft
Cairo
01117275779
Original Message:
Sent: Mon May 26, 2025 03:22 AM
From: Mostafa Mosaad
Subject: SRMOBILE Location lookup
Hi Bartosz,
Thanks a lot for the information - much appreciated.
Unfortunately, due to the client's environment policies, I won't have access to the container to pull the backend code any time soon. I'm currently restricted to working within the online AppFramework, which only provides access to app.xml
and appcustomization.js
.
I was thinking along the lines of using a ternary clause within the mxapioperlocation to check against the state you mentioned, but I haven't been able to get it to work just yet.
Thanks again, and I'll keep you posted if I manage to find a workaround.
Best regards,
------------------------------
Mostafa Mosaad
Software Engineer
Megasoft
Cairo
01117275779
Original Message:
Sent: Sun May 25, 2025 03:13 PM
From: Bartosz Marchewka
Subject: SRMOBILE Location lookup
Hi @Mostafa Mosaad
In my opinion you should be able to achieve that by customising this method CreateSRController:drillInLocation(item
)
.
Information about the current selected category you can find in this state variable: this.app.state.topcategorydesc
------------------------------
Bartosz Marchewka
IBM Maximo Consultant
AFRY
Original Message:
Sent: Sun May 25, 2025 05:52 AM
From: Mostafa Mosaad
Subject: SRMOBILE Location lookup
Dears,
I hope you all are doing very well.
I'm currently working on a case on the SRMOBILE where we have two types of locations: ATMs and Branches, and three main classifications: OM, SOFT, and ATM.
The requirement is as follows:
When a user selects OM or SOFT as the main classification, the location lookup should display Branch locations only.
When the user selects ATM as the main classification, the lookup should display ATM locations only.
I've been trying to implement this logic but have been stuck for a while. If anyone has suggestions or can point me in the right direction, it would be greatly appreciated.
NOTE: I know that in most of the cases the drilldown won't work but this is not a big issue for me, the most important that the search functionality separates the locations
Thank you in advance for your support!
------------------------------
Mostafa Mosaad
Software Engineer
Megasoft
Cairo
01117275779
------------------------------