Hi All #RoundingOff #FloatToDecimal #XSD 1) We have a CDT wherein one of it

Hi All #RoundingOff #FloatToDecimal #XSD
1) We have a CDT wherein one of its field was defined with 'float' property (mapped to the table with the type of float as well in the database).
This is how that field in the XSD looked like.
           <xsd:element name="FundAmt" nillable="true" type="xsd:float">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Column(name="fund_amt", columnDefinition="FLOAT")</xsd:appinfo>
</xsd:annotation>
</xsd:element>
          
Now in the process, the above CDT field holds the value = 6244676.65. When this is passed to 'Write to Data Store' node (in order to insert the value to the table in the database) - Appian is converting is to 6244676.50 automatically which is bit strange as there is NO explicit rounding done in either Appian process or Database end.

2) Now if I go to the database and manually update this figure in the table from 6244676.50 to the correct one ie, 6244676.65 and ...

OriginalPostID-203985

OriginalPostID-203985

  Discussion posts and replies are publicly visible

  • ...then hit a query rule/query entity on Appian, it still shows the incorrect one, ie, 6244676.50 (when tested directly on the interface).

    The above behavior is something which is not getting occured for all the figures but are some random values(not able to figure that out if there is some specified range for this to happen). For most of the figures, it does gets entered and displayed correctly.

    As a workaround, we modified the above CDT field annotation to change the field type from 'float' to 'decimal', keeping the columnDefinition (table column type) still same to 'float', thereafter which everything works fine. (see below the updated definition)
               <xsd:element name="FundAmt" nillable="true" type="xsd:decimal">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="fund_amt", columnDefinition="FLOAT")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    Not sure, why Appian treats data type of 'float' differently from 'decim...
  • Are you sure this is not just a matter of formatting? Try this expression

    =with(local!value: todecimal(6244676.65),
    local!value & " - " & text(local!value, "#.##")
    )

    For me it returns:

    6244677 - 6244676.65
  • @siddharth, For FLOAT, the corresponding Appian type is Number (Decimal) and respective DB types are as follows:
    MySQL - float
    SQL - float
    Oracle - float.
    This is reason your alternate approach of changing the CDT type to Decimal worked.
    You may go through below link for more details
    https://forum.appian.com/suite/help/7.9/Custom_Data_Types_from_XSD.html
  • Hi Vishnu - thank you for your response.I went through this link and under "Mapping CDT Fields to RDBMS Columns" section - the XSD type = float has Number (Decimal) in Appian and "float" as data type in the mentioned databases, which was my case earlier which wasnt working for me - wherein in XSD I specified 'float'.

    If we are saying that 'float' should not be specified in the XSD definition for any fields and should always be Number(Decimal), Appian should not allow this to upload in the system, however since it does, then why its some random values which are giving this strange behavior and not all values.