Tagged: , ,

Viewing 0 reply threads
  • Author
    • #9270

      Often we’re asked how to cast a field as a string, integer or float using the rawdata API


      The first step is to transform the data field that you want to request data for.
      This is done inside the fields param, by writing the new value, followed by :@ and the field to transform, finally to cast it as a separate type you can do __str, __int, __float for string, integer, and float casting respectively.
      Thus for casting the latitude as a string it would be:

      results in: "latitude_string": "4.696300000000001",

      To get the value as an integer you’ll need to also multiply it by 100000 first,

      results in: "latitude_float": 469630.0000000001,

      Finally to get rid of any decimals you can round the value.

      results in: "latitude_integer_rounded": 469630,

      Full example


Viewing 0 reply threads
  • The topic ‘How to cast fields as strings, integers, or floats in rawdata API’ is closed to new replies.