Forum Discussion

tripp-bishop's avatar
12 years ago

user id number format issue

Hello,

We're experiencing a surprising issue on our site. Here's the basic error that we're seeing in one of our endpoints:

error: Can't convert this string to number: "10,707"
The blamed expression:
==> user.id?number  [in template "my-endpoint.ftl" at line 28, column 92]

The failing instruction (print stack trace for 1 more):
==> #assign statusMsg = statusMsg + "," +...  [in template "my-endpoint.ftl" at line 28, column 33]",


What we're seeing is that users with a large user id are having their user ids formatted with a comma (like 10,707 in the example above). To counter this, we're doing the following (this is the offending line of code from the error message above, line 28 in the endpoint):

<#assign statusMsg = statusMsg + "," + incrementCount(user.id?number?c, fieldName) />

as you can see, we're using the ?c method to create a machine formatted number that doesn't have any number formatting characters in it.
We've used a similar approach in the past for dealing with message ids that were > 999 as these were also getting formatted as x,xxx and causing rest call urls to break. However, we're not sure why this isn't working for user.id. We have a temp fix for some of our endpoints where we do the following:

user.id?string?replace(",","")?number?c but this is really clumsy and I'm hoping that there's a more elegant and generalized way that we can handle this issue.

 

Thanks!

1 Reply

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    Hi Tripp,

     

    Have you tried just "user.id?c" instead? I've used that approach in the past and I don't recall having any issues. Let us know if it doesn't work for you!

     

    -Adam