Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  How to query non-persistence attribute using Automation script

    Posted Thu December 31, 2020 11:00 AM
    Hi All,

    FLTASKSELECTION is a non-persistence attribute and I need to use this attribute to validate that the task is selected or not but for a work order we have more tasks so to validate the selection I am using while loop on SHOWTASKS relationship in automation script.

    Is there any way where I can directly get the selected work order task by having where clause FLTASKSELECTION = 1.
    I tried to query by using MBOSet where but no luck. 

    taskSet = mbo.getMboSet("SHOWTASKS")
    taskSet .setWhere("FLTASKSELECTION=1")

    Any suggestions would be helpful.


    ------------------------------
    Thanks
    Sudhindra Shivanagere
    ------------------------------

    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: How to query non-persistence attribute using Automation script

    Posted Mon January 04, 2021 08:59 AM
    No, the where clause is a SQL where clause so it has to evaluate to proper SQL. Because the attribute doesn't exist as a column it will fail. You can reference non-persistent values (IE column=:fltaskselection), where the value in the non-persistent attribute fltaskselection will be used to build the where clause but can't query a non-existent column.

    I'm not entirely sure the purpose of this attribute, but there is the concept of "selecting" a MBO and you can retrieve the records that are selected via that. For example, when you have a multi-select dialog (such as the Select Assets dialog in Work Order Tracking) and have all the checkboxes next to the box, you can retrieve what the user has selected by calling getSelection() (IE selectedRecords=taskSet.getSelection())

    Since I think your attribute is custom, you could flag the MBO as selected (calling .select() on the MBO) when the value is 1 and then use the getSelection to retrieve the records. 

    Unless there's too significant of a performance hit iterating through the set to find your records, it might not be worth this effort though. I assume the reason you don't want to continue iterating through the set is performance related so hopefully this will help.

    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------



  • 3.  RE: How to query non-persistence attribute using Automation script

    Posted Tue January 05, 2021 03:02 PM
    Thanks Steven Shull for the suggestions. I have tried with MBO selections but got the below error and please let me know if anything I need to change in the script.
    Here is the script details:

    taskSet = mbo.getMboSet("SHOWTASKS")
    selectedRec = taskSet.getSelection()


    BMXAA7837E - An error occured that prevented the CSTIMER script for the CSTIMER launch point from running.
    AttributeError: 'java.util.Vector' object has no attribute 'getMbo' in <script> at line number 105


    ------------------------------
    Thanks
    Sudhindra Shivanagere
    ------------------------------



  • 4.  RE: How to query non-persistence attribute using Automation script

    Posted Wed January 06, 2021 08:29 AM
    Sorry, I should have clarified that the return time is a vector of MBOs. To iterate through it you can't use getMbo. We use something like below. The taskMbo in this example would be your task MBO you need. 

    if selectedRecords:
        iterator=selectedRecords.iterator()
        while iterator.hasNext():
            taskMbo=iterator.next()​


    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------



  • 5.  RE: How to query non-persistence attribute using Automation script

    Posted Fri January 08, 2021 01:25 PM
    Thanks a lot Steven Shull for your inputs. Let me try this logic and hope I may able to over come performance issue :) with this code

    ------------------------------
    Thanks
    Sudhindra Shivanagere
    ------------------------------