# Search number with decimal point

**URL:** <https://forum.servoy.com/t/search-number-with-decimal-point/14043>\
**Category:** Classic Servoy\
**Created:** [May 25, 2011, 12:29pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043 "2011-05-25T12:29:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [May 25, 2011, 12:29pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/1 "2011-05-25T12:29:20Z")

</div>

I’ve noticed when searching on fields of datatype number with foundset.find() and foundset.search() Servoy loses the decimal point…

I have tried :

\_a = 10 / 4

1. \_fs.number\_field = ‘\>=’ + \_a
2. \_fs.number\_field = ‘\>=’ + \_a + ‘|00000.00’
3. \_fs.number\_field = ‘\>=’ + \_a + ‘|00000,00’

In all cases when I look at : databaseManager.getSQLParameters(\_fs)  
I see the value : 25.0 in stead of 2.5

Have I missed something ? I cannot find anything in Wiki or on forum…

Servoy 5.2.8

Regards,

---

<div class="post-metadata">

**Author:** ![Hans\_Nieuwenhuis](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@Hans\_Nieuwenhuis](https://forum.servoy.com/u/Hans_Nieuwenhuis)\
**Post date:** [May 25, 2011, 1:05pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/2 "2011-05-25T13:05:29Z")

</div>

I noticed this too when the locale is set to Nederlands.  
If I set it to English (us) there is no issue.  
I guess it has to do with decimal point that is not interpreted…

Regards,

---

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [May 25, 2011, 2:56pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/3 "2011-05-25T14:56:07Z")

</div>

Thanks Hans,

But then option 3) should work…  
I think format (|…) is not supported with number fields ?

Please comment, Servoy

---

<div class="post-metadata">

**Author:** ![Hans\_Nieuwenhuis](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@Hans\_Nieuwenhuis](https://forum.servoy.com/u/Hans_Nieuwenhuis)\
**Post date:** [May 25, 2011, 2:56pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/4 "2011-05-25T14:56:46Z")

</div>

I tried using ```  
'=\> ’ + \_a.toLocaleString()

```but

B.t.w. this is the same for 5.2.7 and 5.2.8
```

---

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [May 25, 2011, 3:03pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/5 "2011-05-25T15:03:59Z")

</div>

You mean ' **\>=** ’ + \_a.toLocaleString() ?

---

<div class="post-metadata">

**Author:** ![Hans\_Nieuwenhuis](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@Hans\_Nieuwenhuis](https://forum.servoy.com/u/Hans_Nieuwenhuis)\
**Post date:** [May 25, 2011, 3:05pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/6 "2011-05-25T15:05:44Z")

</div>

I noticed that

```auto
_fs.number_field = '>=' + _utils.numberFormat(_a, '#,###.00')

```

Does use the locale settings and the your code works !

If you display the value of ‘\>=’ + \_utils.numberFormat(\_a, ‘#,###.00’) it is =\> 2,50 when the locale is Netherlands

---

<div class="post-metadata">

**Author:** ![lwjwillemsen](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/lwjwillemsen/32/4987_2.png) [@lwjwillemsen](https://forum.servoy.com/u/lwjwillemsen)\
**Post date:** [May 25, 2011, 3:19pm UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/7 "2011-05-25T15:19:17Z")

</div>

Ok, thanks. I was just on my way to test the utils.numberFormat() !

Regards,

---

<div class="post-metadata">

**Author:** ![Hans\_Nieuwenhuis](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@Hans\_Nieuwenhuis](https://forum.servoy.com/u/Hans_Nieuwenhuis)\
**Post date:** [May 26, 2011, 6:10am UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/8 "2011-05-26T06:10:05Z")

</div>

Could one of the Servoyans comment on this ?

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 30, 2011, 9:05am UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/9 "2011-05-30T09:05:09Z")

</div>

numberFormat() is exactly what you need to do, there is currently no other solution for this.

If you set something through scripting then you have to set it the same way as a user would do it in a textfield.

So yes a dutch guy would type: 10,09 and a guys from the usa: 10.09

So you must make sure if you do in find:

dataprovider = “\>=” + number

that that number is formatted the way the locale expects it to be.

---

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [May 30, 2011, 9:33am UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/10 "2011-05-30T09:33:44Z")

</div>

This is important enough for the wiki, isn’t it?

---

<div class="post-metadata">

**Author:** ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)\
**Post date:** [May 30, 2011, 10:19am UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/11 "2011-05-30T10:19:17Z")

</div>

Will make sure it gets added in the appropriate locations.

Paul

---

<div class="post-metadata">

**Author:** ![michel](https://avatars.discourse-cdn.com/v4/letter/m/ea666f/32.png) [@michel](https://forum.servoy.com/u/michel)\
**Post date:** [May 30, 2011, 10:22am UTC](https://forum.servoy.com/t/search-number-with-decimal-point/14043/12 "2011-05-30T10:22:27Z")

</div>

Okay, thanks!
