Skip to main content
vijaykumars5676
December 27, 2022
Question

cast from Record Field to Number (Decimal)

  • December 27, 2022
  • 3 replies
  • 0 views

I'm using record type to create a column chart.

The field which I am using is stored as text in the database. 

See line 14 in the attached screenshot.

Can I change it to decimal to use in measure?

    3 replies

    stefanhelzle0001
    Brainy
    December 27, 2022

    This does not work the way you expect. The field parameter in line 14 requires a reference to the field itself. And you cannot add any type casting here. Does the query work for you without any casting? What is the reason to store that total as a text vs. a decimal?

    vijaykumars5676
    December 27, 2022

    Thanks.
    I used IDP and stored data in the database as text and did not think about this before.

    December 27, 2022

    Can you try using toUniformString before  toDecimal just to avoid typeCast error..., but if you want to apply sum function over that field..go to your Data base >> that particular table>>table structure>>now change the type of the field(float/decimal), now download xsd from the respective cdt, make the same type change as you did in the table(with in XSD) then save changes,now go to your cdt...,  create new version from xsd(just suggestion before creating new version, just close all remaining tabs for the rules this cdt is a precedent, because this creates versions i.e  Example:student^4 etc),, now go and test your recordType/ interfce where you are using this