Maximo

Expand all | Collapse all

Can formulas return null?

  • 1.  Can formulas return null?

    Posted Mon December 23, 2019 09:20 AM
    In Maximo 7.6.1.1,

    I have an attribute formula on a persistent field called WORKORDER.X. The field type is decimal, length is 18, and scale is 10.

    The formula is meant to do this:

    If not null, use WOSERVICEADDRESS.LONGITUDEX
    Else, if not null, use ASSET.X
    Else, if not null, use LOCATION.X

    This is the expression I've come up with:
    NVL(SERVICEADDRESS$LongitudeX, NVL(ASSET$X, NVL(LOCATION$X,0) ) )

    Question:
    If all of the search-values end up being null, is there a way to return null, rather than 0?

    I've tried just typing the word null, but get an error:
    BMXAA9399E - This formula is invalid because the following attribute or token is
    invalid: null. Specify a valid attribute and try again.

    I've also tried "", but that returns 0.


  • 2.  RE: Can formulas return null?

    Posted Mon January 06, 2020 07:52 AM
    Edited by Serge Gagnon Mon January 06, 2020 07:52 AM
    Did you try "IF(isnull$WORKORDER.X...." instead of NVL ? You can use a condition as well. If it does not work, sometime it's easier to use an automation skip instead of a formula. Your case is easy to code in a script.

    ------------------------------
    Serge Gagnon
    STI Maintenance
    Jonquiere QC
    ------------------------------



  • 3.  RE: Can formulas return null?

    Posted Mon January 06, 2020 01:32 PM
    Edited by User1971 Mon January 06, 2020 01:34 PM
    Hi Serge. Good idea. Thanks.

    I tried IF instead of NVL, but unfortunately, I still have the same problem. I can't return null:

    IF(1=1,1,null)

    BMXAA9399E - This formula is invalid because the following attribute or token is invalid: null. Specify a valid attribute and try again.

    And returning the value of a field that is known to be null (as a workaround) produces an error too (IF(1=2,2,X)).
    Also, double-quotes returns zero, not null (not what I'm looking for). 


    ------------------------------
    Thanks
    ------------------------------