Maximo Open Forum

 View Only
  • 1.  REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-06-2022 09:44
    Created custom table with few columns with decimal (5,2).
    Created table domain using this table with list where 1=1.
    Created Object structure having this parent object  as maxdomain and custom table in step1 as child ( with relationship).

    When we load the domain data via rest get request data is not giving decimal values correctly 25.5  is returned as 25.
    can anyone faced similar issue or do know what should be causing this ?
    #Integrations

    ------------------------------
    PDB
    ------------------------------


  • 2.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-06-2022 11:27
    Just to confirm my understanding... you have a custom object that you're loading records into as part of an object structure that contains MAXDOMAIN as the parent object and goes from MAXDOMAIN->CUSTOMTABLE in the object structure. Your records are loading into Maximo correctly (IE the value in the database is 25.5) but when you then retrieve the records utilizing the same object structure via the REST API it's being returned as 25 instead of 25.5. Is that correct? 

    What happens if you have an object structure against just your custom object? Since this is a table domain (not an ALNDOMAIN), having MAXDOMAIN as the parent object doesn't make sense. When loading records, you typically want an object structure that is representative of how you would modify the records in Maximo. ALNDOMAIN requires an owner of MAXDOMAIN because that's how it works in the UI. In your case of a custom object, your custom object should be fine as the main object. Whether the custom object is used in a table domain or not, the logic there is the same so there is no need to link back to the MAXDOMAIN record.

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



  • 3.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-06-2022 11:58
    Hi Steven.
    Thanks for your response.

    Yes when create Object Structure just on custom table it returns data properly.

    We have set up this custom object structure with maxdomain and then child as we have custom UI outside maximo which load these domain data by further filtering and logic using oslc query clause , scripts etc.

    ------------------------------
    Prashant B
    ------------------------------



  • 4.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-07-2022 08:36
    This may be a long shot but when we used REST API to send data for POs it was sending it in scientific notation and we found System Property mxe.int.usescientific for this. It may not address your issue but is a simple test to try.

    ------------------------------
    Michael Marsonet
    OSV Advisory Inc.
    ------------------------------



  • 5.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-07-2022 23:36
    Thanks Michale but this property is already set to true in my instance and still issue occurs

    ------------------------------
    Prashant B
    ------------------------------



  • 6.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-07-2022 09:54

    I tried a similar example in my environment by duplicating the MXDOMAIN object structure and adding in WORKORDER as a child object of MAXDOMAIN with a custom relationship (EMXWORKORDER) with a where clause of 1=1 (so would return all work orders).

    I then executed a GET request like:

    /maximo/oslc/os/emxdomain?lean=1&oslc.select=domainid,workorder{wonum,description,estlabcost,estmatcost}&oslc.where=domainid="WOSTATUS"&maxdomain.emxworkorder.where=wonum="1022"


    This filtered my WO data to just a single WO for performance reasons but the data came back as I would expect:

        "member": [
            {
                "_rowstamp": "19957174",
                "workorder_collectionref": "http://mx7vm/maximo/oslc/os/emxdomain/_V09TVEFUVVM-/emxworkorder",
                "href": "http://mx7vm/maximo/oslc/os/emxdomain/_V09TVEFUVVM-",
                "workorder": [
                    {
                        "_rowstamp": "59668801",
                        "localref": "http://mx7vm/maximo/oslc/os/emxdomain/_V09TVEFUVVM-/emxworkorder/0-202",
                        "description": "Electric Cart Tune-Up test",
                        "estmatcost": 24.68,
                        "href": "http://childkey#TUFYRE9NQUlOL1dPUktPUkRFUi9CRURGT1JELzEwMjI-",
                        "estlabcost": 18.5,
                        "wonum": "1022"
                    }
                ],
                "domainid": "WOSTATUS"
            }
        ]

    I also tried what would happen if it wasn't part of the object structure (just retrieved utilizing the rel.emxworkorder) and that worked as expected as well.

    I can't think of how Maximo wouldn't understand the data type for a particular field because it's a child of another object. The only thing I could think of is there is some manipulation of the data (such as an automation script) and that is calling the wrong method to retrieve the value. Is it possible you have an OSOUT automation script on the object structure in question? 


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



  • 7.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-07-2022 23:17
    Thanks Steve for your response.
    As I mentioned in previous message we are not fetching data from child table itself but we have created table domain for that table and loading the domain via script like
    https://mymaximo.com/maximo/api/script/loadtabledomains?lean=1&oslc.select=*&queryName=getXXXTableDomain

    and getXXXTableDomain is my query clause to load multiple table domains in my external code based on specific rules/logic.
    There this data is not coming proeprly.

    ------------------------------
    Prashant B
    ------------------------------



  • 8.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-08-2022 14:02

    You had mentioned a couple times that you created an object structure with the parent of MAXDOMAIN & a child of your custom object so the assumption was you were retrieving utilizing that. The REST API "/maximo/api/script/loadtabledomains?lean=1&oslc.select=*&queryName=getXXXTableDomain" is executing an automation script which means any processing is coming from your code (your loadtabledomains script). By default, nothing would go into Maximo or be returned back in the response when you call an automation script. You have to write all of that logic yourself and at some point in your process you're losing the accuracy.

    I would strongly not recommend writing your own data retrieval method. We have a ton of functionality in our APIs that you won't be able to use. 



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



  • 9.  RE: REST get call not fetching decimal data correctly ...its retrieving in integer value only

    Posted 09-09-2022 01:15
    Hi Steve,

    I agree to your suggestions but its been already implemented by earlier developers over initial implementations and we have to stay with that design for now as impact is wider to redesign . Hence new additions of domains within those query clause we had to follow same design for now. Thanks for your inputs though.

    ------------------------------
    Prashant B
    ------------------------------