In Maximo sometimes we need to query according to some MBO properties, for example, according to the status and Reportdate properties, this can be achieved by Mbosetremote Setwhere method. The following code shows how to query the results based on status and Reportdate. This is because the Oracle database is used in the background, so Oracle's date function is used.
Import Psdi.mbo.MboRemote;
Import Psdi.mbo.MboSetRemote;
Import psdi.util.MXException;
Import psdi.util.MXSession;
Import java.rmi.RemoteException;
public class Testquery {public static void main (string[] args) throws Exception {mxsession mxsession = null;
try {mxsession = Getmxsession ();
Mbosetremote mbosetremote = (mbosetremote) mxsession.getmboset ("WorkOrder"); Mbosetremote.setwhere (status = ' close ') and (Reportdate between to_date (' 1999-01-01 ', ' yyyy-mm-dd ') and To_date ('
2014-01-01 ', ' yyyy-mm-dd '));
Mbosetremote.setqbeexactmatch (TRUE);
int idx = 0;
Mboremote mboremote = Mbosetremote.movefirst ();
while (true) {if (Mboremote = null | | | idx >=) {break; } System.out.println (Mboremote.getstring ("wonum") + ":" + mboremote.getmbovaluedata ("Reportdate"). GetData
Asdate ()); Mboremote= Mbosetremote.movenext ();
idx++;
} catch (Exception ex) {ex.printstacktrace ();
finally {closemxsession (mxsession); } public static Mxsession Getmxsession () throws RemoteException, mxexception {String Server = "