Maximo Open Forum

 View Only
  • 1.  Using variables in setWhere n the automation script

    Posted 5 days ago

    Hello,

    mTS = mbo.getMboSet("VACTIMESHEET")
    mVacstart = mbo.getDate("VACATION_START")
    mEmpno = mbo.getString("ZZEMPLOYEENO")

    I need to have setWere statement to search for a record in mTS object using the following conditions:
    - TS_DATE = mVacstart
    - ZZEMPLOYEENO = mEmpno

    any help will be much appreciated


    #Administration
    #Customizations
    #EverythingMaximo
    #Integrations

    ------------------------------
    Mohammad Moula
    eSolution
    ------------------------------


  • 2.  RE: Using variables in setWhere n the automation script

    Posted 5 days ago

    You could build a where clause using SqlFormat, call setWhere & reset on the MboSet, etc. but it doesn't make sense to do. Let's assume your child object name is VACTIMESHEET (since that's the name of the relationship and most customers make the relationship match the object name).

    I would write this like:

    mTS=mbo.getMboSet("$CURTIMESHEET","VACTIMESHEET","ts_date=:VACATION_START and zzemployeeno=:VACTIMESHEET")

    The first parameter is a unique name that you want to give to reference the set while it's in memory. The second parameter is the object name that you are going to. If the relationship name doesn't match the object name then you should change this. The third parameter is the relationship of how to get from the current record to the child set. Because you are retrieving the values from the current MBO, we can build a dynamic relationship using bind variables. This properly handles parameterization of the data. 



    ------------------------------
    Steven Shull
    IBM
    ------------------------------



  • 3.  RE: Using variables in setWhere n the automation script

    Posted 5 days ago
    Yes, when I changed the relationship name to be as the object name it works fine.
    Thanks a lot






  • 4.  RE: Using variables in setWhere n the automation script

    Posted 5 days ago

    mTS=mbo.getMboSet("$CURTIMESHEET","VACTIMESHEET","ts_date=:VACATION_START and zzemployeeno=:VACTIMESHEET")

    How do I make VACATION_START or TS_DATE is formatted in this statement ?
    Can I use the SimpleDateFormat ? using     ( from java.text import SimpleDateFormat ) ?

    so I want both formatted "dd/MM/yyyy" 

    Thanks



    ------------------------------
    Mohammad Moula
    eSolution
    ------------------------------