Maximo

Maximo

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

 View Only
  • 1.  Populate CHANGEBY using Maximo attribute formula?

    Posted Tue June 15, 2021 10:27 PM
    Edited by System Admin Wed March 22, 2023 11:50 AM

    MAM 7.6.1.2:

    I'm trying to learn how to populate persistent fields without using automation scripts.
    Reason: We already have hundreds of automation scripts. I'm reluctant to create more scripts just to populate simple fields.


    Examples:
    1. I can populate CREATEDDATE and CREATEDBY fields by using default values in Database Configuration (:&DATETIME& and :&PERSONID&).




    2. And I can populate CHANGEDATE using $sysdate$ in a Maximo attribute formula (docs 1, docs 2PDF 1, and PDF 2).



    Question:

    How can I populate CHANGEBY using a Maximo formula? (or any other non-automation script method)
    I've tried some blind guesses like $username$, $user$, $person$, and $personid$. But none of those guesses worked.

    Thanks.


    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Wed June 16, 2021 08:24 AM
    I don't believe there is a variable for this today. The purpose of formulas was related to mathematical calculations for attributes with Excel like functions. The current date/time makes sense as there are a lot of scenarios where you would need to calculate the time difference between two dates. From a mathematical equation perspective, getting the logged in user doesn't make a lot of sense.

    You can do everything in an Automation Script (and more) that you can do with formulas. The advantage to formulas is the syntax (most people are comfortable with Excel style calculations) and not needing to create launch points on all of the attributes for your script to fire properly as values change. For example, if you have 5 attributes that make up the formula, you would need 5 validation/action launch points to ensure that a change in one will recalculate your field if you need it real time (though just the object launch point if you just care on save). 

    From a formula you can call an automation script. You could use that to return the value, but at that point, to me it's better to just write an object launch point save event.

    I understand the desire to minimize the number of automation scripts and it's a good objective. On scripts like this, you could make it a generic script (with multiple launch points) to be used on other objects in the future if you need changedate to be set on other objects so that you at least could re-use it.

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



  • 3.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Wed June 16, 2021 06:44 PM
    Edited by System Admin Wed March 22, 2023 11:52 AM


  • 4.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Wed June 16, 2021 09:16 AM
    Using this as a foundation:

    select * from maxattributecfg where attributename = 'CHANGEBY' and defaultvalue is not null


    I get 6 results that all have    &USERNAME&    as the answer, with no associated class for that attribute.  So I think the answer would be :&USERNAME&

    ------------------------------
    Travis Herron
    ------------------------------



  • 5.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Wed June 16, 2021 09:17 AM
    For further clarity:  use what I wrote in DB Config, not in a formula.

    ------------------------------
    Travis Herron
    ------------------------------



  • 6.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Fri August 13, 2021 01:53 AM
    Thanks Travis. That's an interesting approach. 

    For what it's worth, this is what I have:



    It's interesting that the last one has a class: psdi.plust.app.plustcount.PlusTFldCBChangeBy


  • 7.  RE: Populate CHANGEBY using Maximo attribute formula?

    Posted Wed September 22, 2021 03:59 PM
    Edited by System Admin Wed March 22, 2023 11:51 AM
    Ultimately, the problem was that we can't populate text fields via formulas. We can only populate number fields with formulas.

    So if the username is text, then we can't use a formula to populate it in a text field.

    However, in my case, person IDs are numbers. So I might be able to populate a custom numeric person ID field with a formula instead (cast "text" to numbers via a function). Although there might be problems with that that I haven't considered. Like, are all person IDs numbers? What about edits that are made by the system? I'd need to think about that. And it might depend on the actual table that I'm trying to populate.

    Related: