Thanks for you response and clarifying the response between mobile and web.
Original Message:
Sent: Fri September 13, 2024 08:27 AM
From: Steven Shull
Subject: offline filter for maximo mobile
When you get to differences in behavior between mobile & web, it's often 1 of 2 things.
1) You have conflicting REST API commands in the oslc.select like:
oslc.select=description,description--assetdesc
The REST API will only return data for one of those things, whichever is last. This is why it is critical that you either never alias an attribute or alias an attribute consistently across all data sources. Maximo Mobile behaves differently than the web because it's designed to work offline immediately. It combines all datasources for that object (ASSET in this case) and makes a single large oslc.select. If you had projectid--project in another datasource for example, you would experience an issue in mobile that you would not experience in web.
The best way to confirm this is to look at the mobile schema (/maximo/oslc/graphite/mobile/schema). This shows the lookupSelect (lookup data) or appSelect (transactional) that will be utilized.
2) Your data on the device (either the asset transactional or location lookup data) hasn't been updated to include the new attributes. Unlike the web which is always doing a live pull from Maximo, the device utilizes the cached data. If the schema changes in any way or the data changes on the records in any way, the lookup & transactional data needs to be updated. If you're using the preload database for lookup data, that means ensuring the preload database has successfully regenerated since your changes. If you're using the REST API to download lookup data, you can perform a full data update of supporting data & work list data and that should resolve it.
I don't think it's an issue in your case but in general, I prefer to pass in the item I'm working with to the method rather than trying to pull it from the datasource. For example, when I open a dialog I use something like this:
on-click="openSparePartLookup" on-click-arg="{{'page':page,'item':woDetailsReportWork.item}}"
Then in my AppCustomizations.js I access the item like:
async openSparePartLookup(event){
let item=event.item;
This allows me to get access to the item and all the attributes without needing to pull it in my method. This is especially critical when you deal with 1:many objects like labor transactions, work order tasks, etc. because what the current item in the datasource is often not the record the user clicked on. In this specific situation, your asset datasource should only have 1 record and it should be the record we're on so it's not as important. But I try to keep my process consistent.
------------------------------
Steven Shull
Original Message:
Sent: Thu September 12, 2024 03:15 PM
From: Anbukkarasu M
Subject: offline filter for maximo mobile
Hi Steven,
Thanks for your response, I've tried setQbe() as you suggested, its working fine in preview mode (role based). but when I published and try to open in mobile its not showing the records. could you please share any other way or let me know if I'm missing something.
async maxiLocationLookupData() {
var assetdetails = this.app?.findDatasource('assetDetailsDS');
let projectid = assetdetails.currentItem.projectid;
var maxidsLocationLookup = this.app.findDatasource('locationFilterDS');
await maxidsLocationLookup.setQBE('projectid','=',projectid);
await maxidsLocationLookup.searchQBE();
this.app.showDialog("openLocationLookupEdit");
}
------------------------------
Anbukkarasu M
Original Message:
Sent: Wed September 11, 2024 08:22 AM
From: Steven Shull
Subject: offline filter for maximo mobile
I'm not sure why you think setQBE will force a query execution on the server. Unless you are doing something later like forceSync() on the datasource, it will not go to the server on Maximo Mobile. Below is not quite your example but is an example of using setQBE properly to reduce the dataset and will not go back to the server on mobile.
let assetDs=this.app.findDatasource("assetLookupDS");
assetDs.setQBE('assetnum','=',item.assetnumber);
assetDs.setQBE('siteid','=',item.siteid);
let result=await assetDs.searchQBE();
------------------------------
Steven Shull
Original Message:
Sent: Tue September 10, 2024 06:52 AM
From: Anbukkarasu M
Subject: offline filter for maximo mobile
Hi,
We are using maximo mobile 8.11, here we need to implement a custom lookup where the data gets filtered based on a attribute whenever we open lookup.
our requirement is, we have customized datasource for lookup which is fetching the data for location lookup, in that we have one attribute project id. This project ID changes based on the asset that we open, if we open a asset which have project id = 123 then the location lookup should only show the location which have same project id. we are able to fetch the project id from asset. now we want to filter the lookup data using project id locally without any api calls. we tried setQbe() which needs api call. we have a huge data so api call will be inconvenient.
------------------------------
Anbukkarasu M
------------------------------