Maximo

 View Only
  • 1.  How to display an image on the list view of Anywhere Technician app based on value in a boolean field

    Posted Tue July 19, 2022 08:38 AM
    Hello Team,

    On the default query that is present once we login to Maximo Anywhere, is it possible to display an image conditionally based on a field in the Work Order object?

    We have a boolean field as SAFE which is of YORN/Boolean type and stores 0 or 1.


    We want to display an image as below when SAFE = 1 and nothing if SAFE = 0.

    I have added the icon in the image folder and updated the layout xml.

    Then in the listItemTemplate I have added below line.

    <image id="Safe" image="safe.svg" layoutInsertAt="item6"/>

    After I build and deploy I am able to see the icon but it is present on all the Work Orders despite the SAFE field is 0 or 1.



    In WOListHandeler.js I have created below method and associated in app.xml in image tag by adding in eventHandlers but still the icon is not appearing based on value of SAFE field.


    enableSafeIcon: function(eventContext){

    var workOrder = eventContext.getCurrentRecord();

    if (workOrder.safe == 0) {
    eventContext.setDisplay(false);
    return;
    }
    eventContext.setDisplay(true);
    },


    Is there any way we can conditionally show this image?

    ------------------------------
    SHASHANK .
    ------------------------------



    #AssetandFacilitiesManagement
    #Maximo
    #MaximoAnywhere


  • 2.  RE: How to display an image on the list view of Anywhere Technician app based on value in a boolean field
    Best Answer

    IBM Champion
    Posted Wed July 20, 2022 01:16 AM
    Hi Shashank

    An easier way than that.

    Look at the existing code for a sample:
    <image cssAttributes="internalStatus" cssClass="statusDesc" id="WorkExecution.WorkItemsView_workOrder_WorkListItem_statusimg" image="statusicons/{:internalStatus}.svg" layoutInsertAt="item4" platform="false"/>

    All images are added to this folder"
    ..../IBM/Anywhere/MaximoAnywhere/apps/WorkExecution/common/images/mdpi/statusicons

    In your case, I would suggest adding a sub-folder of your client/businesses name
    i.e. /Users/craig/IBM/Anywhere/MaximoAnywhere/apps/WorkExecution/common/images/mdpi/mycustomer

    Then the code would look like
    <image id="WorkExecution.WorkItemsView_workOrder_WorkListItem_safe_img" image="mycustomer/{:safe}.svg" layoutInsertAt="item6" platform="false"/>

    As your field is boolean, there are two states; true and false.  So the names of the icons would be true.png and false.png

    ------------------------------
    ===============================
    Craig Kokay,
    Lead Senior Maximo/IoT Consultant
    ISW
    Sydney, NSW, Australia
    Ph: 0411-682-040
    =================================
    #IBMChampion2022
    ------------------------------



  • 3.  RE: How to display an image on the list view of Anywhere Technician app based on value in a boolean field

    Posted Thu July 21, 2022 04:06 AM
    Hello Craig,

    I tried the way you suggested and it worked. Many thanks for your input.

    Regards
    Shashank

    ------------------------------
    SHASHANK .
    ------------------------------



  • 4.  RE: How to display an image on the list view of Anywhere Technician app based on value in a boolean field

    IBM Champion
    Posted Wed July 20, 2022 01:44 AM
    Hi Shashank,

    Try writing your code in the render event of the image. Each object in the app has a render event and as per your scenario I think writing your logic for render event or data change event will be a good option. 
    As suggested by Craig, look at the existing code . I will look into the start stop button on the list screen as it is hidden based on data changes.

    Thanks,

    ------------------------------
    Biplab Choudhury
    IBM Champion 2022
    Senior Consultant
    BPD Zenith
    Melbourne
    ------------------------------



  • 5.  RE: How to display an image on the list view of Anywhere Technician app based on value in a boolean field

    Posted Thu July 21, 2022 04:09 AM
    Hello Biplab,

    Thanks for your response.
    I had already tried with render & datachange event but that didn't work for me. It looked like the eventHandleer was not triggering the new function I created which was associated with it.

    Regards
    Shashank

    ------------------------------
    SHASHANK .
    ------------------------------