Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Isomorphic
    replied
    If you declare fields with type:"float", if the server sends a JSON response with strings, you should find that they are turned into JavaScript Numbers.

    Leave a comment:


  • wallytax
    replied
    I think it might be done in the transformResponse() method, but then I need to know which fields are numbers and which are strings. Of course this can all be done, but I was wondering if something like this is already built-in? I'm not sure if Rails is the only platform sending back strings, but from what I find on the internet, it looks like strings are the way to go for numbers that need to be very precise. This is not necessarily the case in my application, a maximum of 5 decimals is sufficient, but I don't think floats are accurate enough for that.

    Leave a comment:


  • Blama
    replied
    wallytax Additionally: This seems to be for display only, so no editing, no formula fields etc. Reading #1 you say "interpret these strings as numbers" -> I don't think this is done by this, so perhaps you are right and it does not help. Then perhaps DataSource.transformResponse?

    Beet regards
    Blama

    Leave a comment:


  • Blama
    replied
    Hi wallytax,

    the feature must affect both client and server, otherwise it would not be in the SmartClient clientside docs. If the server sends strings for numbers clearly the client must be informed to expect strings for numbers.

    Best regards
    Blama

    Leave a comment:


  • wallytax
    replied
    Thanks for the reply, but looking at the docs suggests this is a server side setting causing the response to return strings for decimals. I'm not using SmartClient's server, but I also have strings in the response that I need to parse somehow. So far I haven't find the right solution in Rails to prevent those strings.

    Leave a comment:


  • Blama
    replied
    Hi wallytax,

    I never used this, but there is DataSourceField.stringInBrowser and DataSource.defaultStringInBrowser that sound like they might have an effect in your case.

    Best regards
    Blama

    Leave a comment:


  • Can SmartClient handle BigDecimals sent as strings

    I'm using SmartClient 12.1 in combination with a RubyOnRails server. I use a very old version of Rails that I'm trying to upgrade right now. One thing that I need to fix is that the new Rails versions sends decimals in JSON responses as strings (eg. "10.1"). In the version of Rails that I am upgrading it also did that, but I could use a plug-in that still allowed me to send the numbers as floats. This sort of works but seems to be highly discouraged.

    Basically my question is: is there an easy way of having a data source (or another component) interpret these strings as numbers? Else, I need to fix this on the server somehow. I've read somewhere that JSON not necessarily interprets the numbers as floats, but it might and therefore strings are safer, but of course this affects SmartClient.
Working...
X