In Maximo, we can upload images as attachments in Doclinks
which are stored as files the server or as avatar images which are stored as
binary data inside the IMAGELIB table. Avatar image is quite useful to give the
user a quick view of how an inventory item or an asset/location looks like.
While Maximo allows us to upload Doclinks attachments via
MIF, uploading images to IMAGELIB table via MIF is not supported
out-of-the-box. Therefore, in order to upload image, we can only do it manually
one-by-one via Maximo’s GUI. For bulk loading, if we have access the DB server,
we can write a stored procedure to read the files and import binary data
directly into the DB. There are two scenarios I had in the past in which this
approach doesn’t work:
- When we built mobile apps and wanted to upload data to IMAGELIB. In that case, my team mate extended a REST handler class to achieve this requirement.
- When we needed to bulk upload images, but the client did not allow us access to the database and database server.
To address this requirement, we can extend the process
classes of object structure (OS) to encode/decode binary data into Base64
string to deliver the data via XML or JSON format. Since this processing is
done on object structure, it will support both application import/export and
sending/receiving binary data via integration framework’s MEAWEB API or JSON
API.
To encode binary data to base64 text string before exporting
OS data, we can extend MicSetOut.class and associate it to the OS by specifying
the class’s path in the “Outbound Definition Class” field. Below is the sample
code which export Item master data with Image:
To decode base64 string back to binary data before storing
it to IMAGELIB table, we can extend the MicSetIn.class and associate it to the
OS by specifying the class’s path in the “Inbound Processing Class” field.
Below is the sample code:
Once we have the customized classes in place, it is possible to Export/Import ImageLib data using XML format or via web services. It is also quite easy to write a simple Excel/VBA program to bulk upload images via MIF without the need to have direct access to DB server. But these are different topics and perhaps I’ll provide examples in other future posts.
Can you please provide me with example how to load images through MIF It is also quite easy to write a simple Excel/VBA program to bulk upload images via MIF without the need to have direct access to DB server.
ReplyDeleteYou can down load the sample Excel/VBA tool in this repo: https://github.com/viettranit/ImgLibUpload
DeletePlease provide an information on how to extend REST hadler class. We are trying to add images to the existing items and apparently REST doesn't allow updates of ITEMIMAGE structure. It rejects the POST process because ITEM already exists. Thanks in advance
ReplyDeleteHi, you should use "Sync" or "AddChange". If you use "Add", it won't update existing items
DeleteHi Viet , do you this configured using automation scripts and excel to export the data with images ?
ReplyDeleteEssentially, this post is to prove that we can import/export data with images using MIF, thus make it possible from the front-end by the power users. Such as migrating a bunch of data from DEV/TEST to PROD. Otherwise, we have to use DB functions/feature to do it, which can only be done by technical people. However, the requirement to export ImgLib is quite rare. The most common requirement is to import image files into Maximo. I remembered posting this after a SaaS project where we didn't have access to the database, thus I tried to use MxLoader as an adhoc SQL tool to access the database
DeleteHi Viet Tran - I saw the xlsm file on github and it mentions MXLITEM which is anot a default object structure. I know I have an MXITEM from Bruno's MxLoader. I wonder if there's Excel spreadsheet we can use like MxLoader that can perform the insert to IMGLIB. Are custom java classes still required, or do you think this is possible through automation scripts? I know IN Maximo 7.6.0.8 Python is 2.6 -- but I ran across instructions for Oracle to insert data via Python (https://oralytics.com/2020/09/07/loading-and-reading-binary-files-in-oracle-database-using-python/) but we obviously would prefer to use any delivered API Maximo uses for best data compatibility.
ReplyDeleteAlso, what about MxLoader 7.5.2 NextGen, I was able to upload file attachments successfully. Do you think I could do the same for IMGLIB table for image blobs?
Any thoughts?
- It's the same as the MXITEM2 object structure shown in the image in this post.
Delete- If you use integration script as mentioned in here, you don't have to use custom java code
- With smaller clients which I have access to the database, I would load the data directly to the database as it's the fastest method. But unfortunately, with bigger clients, we don't usually have access to the database. Using code to talk directly to the database, bypassing Maximo business layer, is also against best practice.
- I haven't tried the new MxLoader version to upload ImgLib. The older versions (5.x or older) cannot do this. The main problem is we have to modify Maximo to decrypt base64 data as mentioned in this post. Once that's done, you can use the example Excel file to upload data, or use the code in it to modify MxLoader.
Thanks anh kkk :P
ReplyDelete