Maximo

 View Only
  • 1.  Multiple Select in Maximo

    Posted Tue March 22, 2022 02:12 PM
    Hello,

    I have a need to set multiple choice option in custom domain table.

    In LOOKUPS.XML I have set selectmode="multiple". In lookup list we can see that we could choose mutliple values, but is not working. In customfield is always one value.



    I was searching and found this article Multiple Select in Maximo
    I tried but is not working as expected. Any idea how we could set multiple choice in custom domain table?

    ------------------------------
    Blaz Rakar
    ------------------------------

    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Multiple Select in Maximo

    Posted Wed March 23, 2022 04:39 AM
    Hi,

    what exactly is "not working as expected"? We have set up similar requirements and it can be done, although I have not tried the method from the link you have posted.

    Have you made sure to replace all the dummy and placeholder names in the code with your values?

    Best,
    Fabian

    ------------------------------
    Fabian Selzer
    ------------------------------



  • 3.  RE: Multiple Select in Maximo

    Posted Wed March 23, 2022 10:50 AM

    Blaz,

    Without more details as Fabian asks for, I do notice that the post you link to mentions that a custom bean is required to back this.  Did you develop and deploy a custom bean to work with your multiselect?

    Jason



    ------------------------------
    Jason VenHuizen
    https://sharptree.io
    https://opqo.io
    ------------------------------



  • 4.  RE: Multiple Select in Maximo

    Posted Thu March 24, 2022 08:21 AM
    Hi,

    Thanks for your and Fabian reply. I add this custom bean and redeploy maximo. 

    import java.rmi.RemoteException;
    import java.util.Iterator;
    import java.util.Vector;
    import psdi.mbo.MboRemote;
    import psdi.util.MXException;
    import psdi.webclient.system.beans.LookupBean;
    import si.sz.webclient.asset.MLMultiSelectTest;

    public class MLMultiSelectTest extends LookupBean {
    private static String comma = ", ";

    public void initialize() throws MXException, RemoteException {
    super.initialize();
    String fieldToSet = getParent().getReturnAttribute();
    MboRemote mbo = this.app.getDataBean().getMbo();
    String value = mbo.getString(fieldToSet);
    String[] values = value.trim().split("\\s*,\\s*");
    for (int i = 0; i < values.length; i++) {
    for (int j = 0; j < getMboSet().count(); j++) {
    if (values[i].trim().equalsIgnoreCase(getMboSet().getMbo(j).getString("value").trim()))
    getMboSet().select(j);
    }
    }
    }

    public int execute() throws MXException, RemoteException {
    boolean onListTab = this.app.onListTab();
    if (onListTab)
    return super.execute();
    String commaString = new String();
    String fieldToSet = getParent().getReturnAttribute();
    Vector<?> selectedRecords = getMboSet().getSelection();
    Iterator<?> selectionIterator = selectedRecords.iterator();
    while (selectionIterator.hasNext()) {
    MboRemote currentSelectedValue = (MboRemote)selectionIterator.next();
    if (commaString.length() == 0) {
    commaString = currentSelectedValue.getString("VALUE");
    continue;
    }
    commaString = commaString + comma + currentSelectedValue.getString("VALUE");
    }
    MboRemote mbo = this.app.getDataBean().getMbo();
    mbo.setValue(fieldToSet, commaString, 1L);
    this.app.getAppBean().refreshTable();
    return 1;
    }
    }

    In LOOKUPS.XML 
    I set my custom table domain like that:

    <table id="MXZRINFCH" inputmode="readonly" orderby="alnvalue asc" selectmode="multiple">
    <tablebody displayrowsperpage="20" filterable="true" filterexpanded="true" id="mxzrinfch_lookup_tablebody1">
    <tablecol dataattribute="alnvalue" id="mxzrinfch_01" label="Vrednost" mxevent="selectrecord" mxevent_desc="Go To %1" sortable="true" type="link"/>
    </tablebody>
    </table>

    In LIBRARY.XML I remove this:

    <dialog beanclass="psdi.webclient.system.beans.LookupBean" icon="img_lookup.gif" id="lookup" label="Izbira vrednosti">
    <lookup id="lookupcontrol"/>
    <buttongroup id="lookup_3">
    <pushbutton default="true" id="lookup_3_1" label="Prekliči" mxevent="dialogcancel"/>
    </buttongroup>
    </dialog>

    and add this :

    <dialog beanclass="si.sz.webclient.asset.MLMultiSelectTest" icon="img_lookup.gif" id="lookup" label="Izbira vrednosti">
    <lookup id="lookup_1"/>
    <buttongroup id="lookup_2">
    <pushbutton default="true" id="lookup_3" label="OK" mxevent="dialogok"/>
    <pushbutton id="lookup_4" label="Cancel" mxevent="dialogcancel"/>
    </buttongroup>
    </dialog>


    After all changes, I tried functionality.

    Domain in other applications with selectmode --> single not work anymore. Also domain where I want multiple select works that I see list, but when I select more values I always get only one value in my field. So any tips will be welcome. Thanks to all.

    ------------------------------
    Blaz Rakar
    ------------------------------



  • 5.  RE: Multiple Select in Maximo

    Posted Mon March 28, 2022 04:04 AM
    I would add a new lookup instead of editing the existing one; that way, your other applications will continue to work.

    As for selecting multiple values, you need to close the dialog with "OK" for it to work - if you click on the last value, it will just return that and discard your selection.

    ------------------------------
    Fabian Selzer
    ------------------------------



  • 6.  RE: Multiple Select in Maximo

    Posted Tue May 31, 2022 09:05 AM
    Hi,

    This solution is working for me now. I just have one question about code, so I have table on application where main object of application is ASSET: And on table below on picture is relationship to my custom object MXZRINF.



    In code here we get mbo ASSET

    currentSelectedValue = this.app.getDataBean().getMbo();
    But in my case mbo is MXZRINF --> custom object. Is there any chance to get mbo MXZRINF in my case?

    ------------------------------
    Blaz Rakar
    ------------------------------



  • 7.  RE: Multiple Select in Maximo

    Posted Wed June 01, 2022 08:17 AM
    It's too late now but in case someone else stumbles on this, I've documented how you can perform multiselect with just automation scripts on this blog post: https://community.ibm.com/community/user/iot/blogs/steven-shull/2022/06/01/multi-select-support-via-automation-scripts

    ------------------------------
    Steven Shull
    ------------------------------