# Setting Multiple Formats

**URL:** https://forum.servoy.com/t/setting-multiple-formats/11811
**Category:** Classic Servoy
**Created:** [February 22, 2010, 1:45pm UTC](https://forum.servoy.com/t/setting-multiple-formats/11811 "2010-02-22T13:45:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)
#### Post date: [February 22, 2010, 1:45pm UTC](https://forum.servoy.com/t/setting-multiple-formats/11811/1 "2010-02-22T13:45:29Z")

</div>

Hi, I have the following situation.

I have a field used to set a discount.  
Therefore I set the format of the field as #%

Now the problem is that sometimes I need to set a float discount (ex: 2,5%).  
The current format wasn’t useful anymore because it rounded the float to 3%.

So I changed to #.0%  
But that implies that if I use a round number it appears as 1,0% instead of just 1%

Is there a way in wich I can use multiple formats and select them depending on what is the format of the value whitout using a converter method?

I’ve tried #.0%||#% but it’s not working and I’m not sure it’s correct.  
What I’m sure is that Servoy allows this kind of format as there is no warning about it. ![:?]( "Confused")

Thanks for the help ![:D]( "Very Happy")

---

<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: [February 22, 2010, 2:00pm UTC](https://forum.servoy.com/t/setting-multiple-formats/11811/2 "2010-02-22T14:00:10Z")

</div>

i think the only way is to toggle the format in onrecord selection method.  
So that you test what you want to show and call setFormat() on it.

---

<div class="post-metadata">

### Author: ![nromeou](https://avatars.discourse-cdn.com/v4/letter/n/779978/32.png) [@nromeou](https://forum.servoy.com/u/nromeou)
#### Post date: [February 25, 2010, 12:58pm UTC](https://forum.servoy.com/t/setting-multiple-formats/11811/3 "2010-02-25T12:58:56Z")

</div>

Ok,  
If that is the only way…  
I’ll have to get my hands dirty.

Thanks for the help ![:D]( "Very Happy")
