Cross-App Datasource Sharing with mobile-shared-data-from
This guide explains how to share datasources between different mobile applications using the mobile-shared-data-from element. This powerful feature prevents duplicate data downloads, reduces bandwidth usage, and improves overall mobile application performance.
- Overview
- How It Works
- Basic Configuration
- Advanced Examples
- Multiple Source Fallback
- Schema Attribute Requirements
- Filtering Shared Data
- Best Practices
- Do's and Don'ts
- Troubleshooting
Overview
The mobile-shared-data-from element allows one mobile application to reuse data that has already been downloaded by another mobile application. This is particularly useful when multiple apps need access to the same reference data (assets, locations, work orders, etc.).
📋 Version Requirement: The
mobile-shared-data-frommechanism was introduced in Maximo Application Suite (MAS) version 9.2.0. Ensure your environment is running MAS 9.2.0 or later to use this feature.
Benefits
- Reduced Data Usage: Download data once, use it across multiple apps
- Faster App Loading: No need to re-download data that’s already available
- Reduced Storage: Single copy of data shared across apps
- Consistent Data: All apps see the same data at the same time
- Better Performance: Less network traffic and faster sync times
- Automatic Fallback: If source app isn’t available, data downloads automatically
When to Use
Use mobile-shared-data-from when:
- Multiple mobile apps need access to the same Maximo object structure
- Reference data (assets, locations, items) is used across apps
- You want to minimize data downloads and storage
- Apps are installed on the same device
How It Works
Data Sharing Architecture
┌─────────────────────────────────────┐│ Source App (e.g., Technician) ││ ┌───────────────────────────────┐ ││ │ maximo-datasource │ ││ │ id="assetDS" │ ││ │ object-structure="MXAPIASSET" │ ││ │ Downloads 500 assets │ ││ └───────────────────────────────┘ │└─────────────────┬───────────────────┘
Validation Process
The Graphite framework automatically validates:
- ✅ Source app exists and is accessible
- ✅ Source datasource exists in the source app
- ✅ Object structures match between source and consumer
- ✅ No recursive linking (A→B→A)
Fallback Behavior
Important: If the source app specified in app-id doesn’t exist or isn’t installed, the datasource will automatically download its own data from the server. This ensures the consumer app continues to function even when the source app is unavailable.
Basic Configuration
Step 1: Identify Source Datasource
First, identify the datasource in the source app that contains the data you want to share:
<!-- In Technician app (techmobile) --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"offline-enabled="true"page-size="50"><schema><attribute name="assetnum"/>
Step 2: Configure Consumer Datasource
In the consumer app, create a datasource with mobile-shared-data-from:
<!-- In Inspection app (inspection) --><maximo-datasourceid="inspectionAssetDS"object-structure="MXAPIASSET"offline-enabled="true"><!-- Share data from Technician app --><mobile-shared-data-fromapp-id="techmobile"
Key Attributes
- app-id: The ID of the source mobile application (must match the app’s
idattribute) - datasource-id: The ID of the datasource in the source app to share from
Advanced Examples
Example 1: Work Order Sharing
Share work order data between Technician and Inspection apps:
<!-- Source: Technician app (techmobile) --><maximo-datasourceid="workorderDS"object-structure="MXAPIWODETAIL"offline-enabled="true"page-size="50"saved-query="ASSIGNEDWORK"><schema>
Example 2: Location Sharing
Share location data across multiple apps:
<!-- Source: Technician app --><maximo-datasourceid="locationDS"object-structure="MXAPILOCATION"offline-enabled="true"page-size="100"><mobile-qbe-filter>{{'status': '=OPERATING'}}
Example 3: Item Master Sharing
Share item/part data for inventory management:
<!-- Source: Inventory app (irmobile) --><maximo-datasourceid="itemDS"object-structure="MXAPIITEM"offline-enabled="true"page-size="200"><schema><attribute name="itemnum"/>
Multiple Source Fallback
You can specify multiple mobile-shared-data-from elements to create a fallback chain. The framework will check each source in order and use the first available one. If none are available, it will download data directly.
Fallback Chain Example
<!-- Consumer datasource with multiple fallback sources --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"offline-enabled="true"page-size="50"><!-- First priority: Try Technician app --><mobile-shared-data-from
How Fallback Works
┌─────────────────────────────────────────────────────┐│ Consumer App Datasource ││ Checks sources in order: │└─────────────────┬───────────────────────────────────┘│▼┌────────────────────┐│ 1. Check techmobile││ app-id │
Real-World Fallback Scenario
<!-- Dashboard app with multiple fallback sources --><maximo-datasourceid="dashboardWODS"object-structure="MXAPIWODETAIL"offline-enabled="true"page-size="10"><!-- Try Technician app first (most complete data) --><mobile-shared-data-from
Benefits of Multiple Sources
- Increased Availability: App works even if primary source isn’t installed
- Flexibility: Users can install any combination of apps
- Optimization: Use the best available data source
- Graceful Degradation: Falls back to direct download if needed
Schema Attribute Requirements
Critical Rule: Subset Requirement
All attributes in the consumer datasource schema MUST be a subset of the source datasource schema. If you request an attribute that doesn’t exist in the source, it will not be available in the consumer datasource.
Correct Configuration
<!-- Source: Has 5 attributes --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"offline-enabled="true"><schema><attribute name="assetnum"/><attribute name="description"/>
Incorrect Configuration
<!-- Source: Has 3 attributes --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"offline-enabled="true"><schema><attribute name="assetnum"/><attribute name="description"/>
What Happens with Missing Attributes
If you request attributes not in the source:
- The attributes will be NULL or undefined in the consumer datasource
- No error will be thrown
- UI components binding to these attributes will show empty values
- This can cause confusion and bugs
Best Practice: Verify Source Schema
Before configuring mobile-shared-data-from, always verify what attributes are available in the source datasource:
<!-- Step 1: Check source datasource schema --><!-- Source app: techmobile --><maximo-datasource id="assetDS" object-structure="MXAPIASSET"><schema><attribute name="assetnum"/><attribute name="description"/><attribute name="status"/><attribute name="location"/><!-- Note: siteid is NOT included -->
Multiple Source Fallback with Schema Considerations
When using multiple sources, ensure all sources have the required attributes:
<!-- All sources must have the attributes you need --><!-- Source 1: Technician app --><maximo-datasource id="assetDS" object-structure="MXAPIASSET"><schema><attribute name="assetnum"/><attribute name="description"/><attribute name="status"/><attribute name="location"/>
Filtering Shared Data
Using mobile-qbe-filter
Apply filters to shared data to show only relevant records:
<maximo-datasourceid="activeAssetDS"object-structure="MXAPIASSET"offline-enabled="true"mobile-qbe-filter="{{'status': '=OPERATING'}}"><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/>
Using QBE Elements
For more complex filtering:
<maximo-datasourceid="criticalAssetDS"object-structure="MXAPIASSET"offline-enabled="true"mobile-qbe-filter="{{'status': '=OPERATING', 'priority': '>5'}}"><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/>
Combining with Page Size
For memory optimization, combine filtering with page-size:
<maximo-datasourceid="recentWODS"object-structure="MXAPIWODETAIL"offline-enabled="true"page-size="20"mobile-qbe-filter="{{'status': '=INPRG'}}"><mobile-shared-data-fromapp-id="techmobile"
Best Practices
1. Choose the Right Source App
✅ DO: Use the app that downloads the most complete dataset as the primary source
<!-- Technician app downloads all assets with full details --><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/>
2. Match Object Structures
✅ DO: Ensure object structures match exactly
<!-- Both use MXAPIASSET --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/></maximo-datasource>
❌ DON’T: Try to share between different object structures
<!-- WRONG: Different object structures --><maximo-datasourceid="assetDS"object-structure="MXAPIASSET"><mobile-shared-data-fromapp-id="techmobile"datasource-id="locationDS"/> <!-- MXAPILOCATION --></maximo-datasource>
3. Use Subset of Source Attributes
✅ DO: Only request attributes that exist in source
<!-- Source has: assetnum, description, status, location --><maximo-datasource id="myAssetDS" object-structure="MXAPIASSET"><mobile-shared-data-from app-id="techmobile" datasource-id="assetDS"/><schema><!-- Request subset that exists in source --><attribute name="assetnum"/><attribute name="description"/></schema></maximo-datasource>
❌ DON’T: Request attributes not in source
<!-- Source only has: assetnum, description --><maximo-datasource id="myAssetDS" object-structure="MXAPIASSET"><mobile-shared-data-from app-id="techmobile" datasource-id="assetDS"/><schema><attribute name="assetnum"/><attribute name="description"/><!-- These won't be available - not in source --><attribute name="location"/><attribute name="siteid"/>
4. Use Appropriate Filters
✅ DO: Filter shared data to show only relevant records
<maximo-datasourceid="myAssetDS"object-structure="MXAPIASSET"mobile-qbe-filter="{{'status': '=OPERATING'}}"><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/></maximo-datasource>
5. Set Appropriate Page Size
✅ DO: Set page-size for memory optimization
<maximo-datasourceid="assetDS"object-structure="MXAPIASSET"page-size="50"><mobile-shared-data-fromapp-id="techmobile"datasource-id="assetDS"/></maximo-datasource>
6. Use Multiple Sources for Reliability
✅ DO: Provide fallback sources for better availability
<maximo-datasource id="assetDS" object-structure="MXAPIASSET"><mobile-shared-data-from app-id="techmobile" datasource-id="assetDS"/><mobile-shared-data-from app-id="inspection" datasource-id="inspectionAssetDS"/><mobile-shared-data-from app-id="maintenance" datasource-id="maintenanceAssetDS"/></maximo-datasource>
7. Document Dependencies
✅ DO: Document which apps and attributes are required
<!--DEPENDENCY: Shares data from techmobile app (primary) or inspection app (fallback).If neither installed, downloads data directly.REQUIRED ATTRIBUTES IN SOURCE:- assetnum- description- status-->
Do’s and Don’ts
✅ DO’s
DO verify source schema - Always check what attributes are available in the source datasource
DO use subset of attributes - Only request attributes that exist in the source
DO use multiple fallback sources - Provide 2-3 fallback sources for better reliability
DO test all fallback scenarios - Test with each source app and with none installed
DO use mobile-qbe-filter - Filter shared data to reduce memory usage
DO set appropriate page-size - Use page-size=“20-50” for most cases
DO document dependencies - Document which apps and attributes are required
DO handle fallback gracefully - Remember data downloads automatically if no source available
❌ DON’Ts
DON’T create circular dependencies
<!-- WRONG: App A shares from App B, App B shares from App A -->DON’T mix object structures
<!-- WRONG: Different object structures --><maximo-datasource object-structure="MXAPIASSET"><mobile-shared-data-fromapp-id="techmobile"datasource-id="locationDS"/> <!-- MXAPILOCATION --></maximo-datasource>DON’T request unavailable attributes
<!-- WRONG: Requesting attributes not in source --><schema><attribute name="assetnum"/><attribute name="customfield"/> <!-- Not in source --></schema>DON’T forget offline-enabled
<!-- WRONG: Missing offline-enabled --><maximo-datasource id="assetDS" object-structure="MXAPIASSET"><mobile-shared-data-from app-id="techmobile" datasource-id="assetDS"/></maximo-datasource>DON’T load all records without filtering - Always use filters to limit data
DON’T assume source is always available - Use multiple fallback sources
Troubleshooting
Issue: Source App Not Installed
Behavior: If the source app doesn’t exist or isn’t installed, the datasource automatically downloads its own data from the server.
What This Means:
- The consumer app will still function normally
- Data will be downloaded directly instead of being shared
- No error will be thrown - this is expected fallback behavior
- If multiple sources specified, checks each in order
Issue: Attributes Showing NULL/Empty
Cause: Requested attributes don’t exist in source datasource schema
Solution: Verify source schema and only request available attributes
<!-- Check source schema first --><!-- Source --><maximo-datasource id="assetDS" object-structure="MXAPIASSET"><schema><attribute name="assetnum"/><attribute name="description"/><!-- location is NOT included --></schema></maximo-datasource>
Issue: “Invalid datasource-id” Error
Cause: The datasource ID doesn’t exist in the source app
Solution: Verify the datasource ID exists in the source app
Issue: “Object structure mismatch” Error
Cause: Source and consumer use different object structures
Solution: Ensure both use the same object structure
Issue: “Recursive linking detected” Error
Cause: Circular dependency between apps (A→B→A)
Solution: Remove circular dependencies - choose one app as source
Issue: No Data Showing
Possible Causes:
- Source app hasn’t synced data yet
- Filters are too restrictive
- All fallback sources unavailable (should download directly)
Solution: Check each fallback source and verify filters
Issue: Performance Problems
Cause: Loading too much shared data without filtering
Solution: Add filtering with mobile-qbe-filter and set appropriate page-size
Summary
The mobile-shared-data-from element is a powerful feature for optimizing mobile application performance by preventing duplicate data downloads. By following the best practices and avoiding common pitfalls outlined in this guide, you can effectively share data between mobile applications while maintaining good performance and user experience.
Key Takeaways
- ✅ Use
mobile-shared-data-fromto share data between apps - ✅ Specify multiple sources for automatic fallback
- ✅ If no source app exists, data downloads automatically
- ✅ Consumer schema attributes MUST be subset of source schema
- ✅ Always filter shared data with
mobile-qbe-filter - ✅ Set appropriate
page-sizefor memory optimization - ✅ Ensure object structures match between source and consumer
- ✅ Avoid circular dependencies
- ✅ Document data sharing relationships and required attributes
- ✅ Test with all fallback scenarios