IBM Sterling Transformation Extender

Sterling Transformation Extender

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

 View Only
  • 1.  ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Wed May 19, 2021 02:20 PM
    Hi ,

    I am facing a issue while loading decimal data to Mongo DB.

    I am trying to default some values in my output card while loading to Mongo DB  ( Value to be loaded as Decimal),


    Data is loading into Mongo through ITX Map as INT32



    Expected  to load  as Double as Below ( which is manually loaded )



    ------------------------------
    Narendra Chimakurthi
    ------------------------------

    #IBMSterlingTransformationExtender
    #DataExchange


  • 2.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 05:30 AM
      |   view attached
    Works for me.  Does you JSON file (being used as a schema/Typetree) include a decimal value?  I think this is key.

    Thank you.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------

    Attachment(s)

    zip
    Decimal.zip   9 KB 1 version


  • 3.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 09:01 AM
    Hi Paul,

      Thank you for the sample , YesJSON file (being used as a schema/Typetree) include  Decimal values When i pass a Number , it is working . But Application requirement is default Amount fields as 0.0 load it as Decimal into Mongo, but when i pass 0.0 Map is converting to 0 making it as Int32

    My schema Json has values as below


    ------------------------------
    Narendra Chimakurthi
    ------------------------------



  • 4.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 09:26 AM
    Does it matter how MongoDB stores 0?  It is still 0.

    When reading the data out to ITX, you would place it into a number object defined as decimal.

    I'm not seeing an issue here.  How are you viewing the MongoDB data to see a field is defined as Int32?

    Thank you.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 5.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 09:56 AM
    It is possible to temporarily rename the .MTX file as .MTT, and edit the properties directly:

    Format = ####.##
    Places Decimal Min = 2​
    Places Decimal Max = 2
    Whole# Min = 1

    ...and then rename back to .MTX, before rebuilding the map.  The data is then sent as 0.00:

    <217460-219696-05/20/21 14:53:05>: | PUT data is :
    {
    "fish" : "Trout",
    "weight" : 0.00,
    "uom" : "Pounds",
    "caught" : "2021-05-20T14:53:02.717Z"
    }
    <217460-219696-05/20/21 14:53:05>: [put] (rc = 0) OK

    ...and the data shows as double in Compass.

    Thank you.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 6.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 10:17 AM
    Edited by System Admin Mon July 24, 2023 03:47 PM
    Hi Paul , is there any editor that we can use to edit  .MTT file , when  i open the file after renaming the file ext , i see lot of special characters


    The Application team is more stringent on this , there application is failing when there are 2 different types of values in collections  , some Mongo documents are loading as decimal when values are some thing like 23.32 , etc and when we load values as 0.0 ITX Map is loading data as Int32.

    ------------------------------
    Narendra Chimakurthi
    ------------------------------



  • 7.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Thu May 20, 2021 10:27 AM
    Open it with Eclipse Extender Studio.

    Thanks.

    ------------------------------
    Paul Brett
     
    IBM Sterling Transformation Extender (ITX) Client Support
    ------------------------------



  • 8.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value
    Best Answer

    Posted Thu May 20, 2021 12:11 PM
    Edited by System Admin Mon July 24, 2023 03:52 PM
    Hi Paul ,

    after changing the .Mtx to .Mtt and update the field to
    decimal Format = ####.##
    Places Decimal Min = 2​
    Places Decimal Max = 2

    and changing back to mtx and build was good , but  when i run the map in Design Studio , studio is crashing  and not inserting data to MongoDB..

    Tried running with command server and same issue 

    ------------------------------
    Narendra Chimakurthi
    ------------------------------



  • 9.  RE: ITX MongoDB Connector - Issue with Defaulting a Decimal Value

    Posted Fri May 21, 2021 05:19 PM
    Hi Paul , The above solution Worked.

    Thanks
    Narendra

    ------------------------------
    Narendra Chimakurthi
    ------------------------------