Retrieve the image file associated to the Asset in Mindsphere
Experts, I have uploaded an image file to Mindsphere and associated the same to an asset. My requirement is as follows: When I retrieve the list of assets and display the same in a Mendix app, upon selecting the specific asset row, I need to pull it’s associated image file from Mindsphere and display it in an iFrame. If anyone had done this before, appreciate if the details can be shared. Thanks, Kalyan
You will have probably created an Image entity in Mendix which is associated with the Asset entity in Mendix. Now when you display Asset objects in a list view or data grid, you can create a data view that listens to the list or grid widget (assets list). On selection of any row, data view is passed that row (asset) object. Now inside this data view, you have the selected asset, you can make Mindsphere call to fetch its image, store it in Mendix and display it.
If you are looking for HTML and JS solution. Use click event for selection and then fetch image, update your Iframe HTML element via JS with new image.
Thank you Umar for the detailed explanation. Appreciate it.
This is how I was trying as you suggested.
1. First thing, in Mindsphere I uploaded an image file to the specific asset
2. Created a dataview that listens to the selected asset row.
Inside this dataview I am trying to call a microflow wherein I want to use the Mindsphere REST API (iotfileservice API) to get the file content. I defined something like this (NOTE: The microflow is not fully complete):
This API returns back the image file as its response. I need some help here in defining the import mapping and how to store this returned image into the entity that is defined with the System.Image as its generalization
In my case I defined an entity called “AssetImg” with System.image set as its generalization. I associated this entity to my “AssetDetails” entity
Any help on the above will be appreciated.
Please ignore. I was able to figure out the above.