Topic
  • No replies
michaelangelomx
michaelangelomx
21 Posts

Pinned topic setwhere() on mboset without reset()

‏2013-05-08T07:29:01Z |

Hi,

I'm trying to filter a mboset in field class LABTRANS.FINISHTIME.  When I call reset(), data is filtered correctly but it does not allow me to save any changes.  Everything works fine without the reset() but I need to filter first the mboset before looping through the records.  Looping in WoTrack-Actual-Labor Application is fine coz labor records are not that many per work order.  But in Labor Reporing Application, default behaviour is to display all records and this could be thousands of records to loop through.

public void validate() throws MXException, RemoteException
{
    super.validate();

    if (getMboValue().isNull())
     return;

    ...
    MboSetRemote labTransSet = this.getMboValue().getMbo().getThisMboSet();

    String sWhere = " laborcode = '" + sLaborCode + "' and startdate = cast('" + sStartDate + "' as datetime) ";
    // String sWhere = " laborcode = :1 and startdate = cast(:2 as datetime) ";  --> for option 2

    // option 1
    labTransSet.setWhere(sWhere);

    // option 2
    SqlFormat sqf = new SqlFormat(this.getMboValue().getMbo().getThisMboSet().getUserInfo(), sWhere);
    sqf.setObject(1, "LABTRANS", "LABORCODE", sLaborCode);
    sqf.setObject(2, "LABTRANS", "STARTDATE", sStartDate);
    labTransSet.setWhere(sqf.format());

    // labTransSet.reset(); --> causing problem

    MboRemote labTrans = null; 
    for (int i=0; (labTrans=labTransSet.getMbo(i))!=null; i++)
    {
     ...
    }
    ...
}

(Maximo 6.2.x)

 

Updated on 2013-05-08T07:42:04Z at 2013-05-08T07:42:04Z by michaelangelomx