Hide number when zero

Questions and answers for designing and implementing forms in Servoy

Hide number when zero

Postby Riccardino » Tue Jun 30, 2009 12:46 pm

Silly question: is there a way to format number fields in order to always show 2 decimals wihout having ".00" empty fields shown?

I tried several combination, but no one does the job...
Any suggestion?
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby lvostinar » Tue Jun 30, 2009 4:52 pm

Riccardino wrote:Silly question: is there a way to format number fields in order to always show 2 decimals wihout having ".00" empty fields shown?

I tried several combination, but no one does the job...
Any suggestion?


use a converter on the column ?
Laurian Vostinar
Servoy
lvostinar
 
Posts: 1062
Joined: Tue Feb 19, 2008 10:53 am

Re: Hide number when zero

Postby Joas » Tue Jun 30, 2009 5:37 pm

Have you tried the format "0.00"? Then it will show "0.00" if the value is 0.
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: Hide number when zero

Postby Riccardino » Tue Jun 30, 2009 6:36 pm

lvostinar wrote:
Riccardino wrote:Silly question: is there a way to format number fields in order to always show 2 decimals wihout having ".00" empty fields shown?

I tried several combination, but no one does the job...
Any suggestion?


use a converter on the column ?


We experienced some strange behaviour with converters (related to CHAR field conversion, to be honest, not to NUMBER fields...), so we are a little cautious in using them.
But I'll give it a try: it's always preferable to a calc field... :-)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby Riccardino » Tue Jun 30, 2009 6:37 pm

Joas wrote:Have you tried the format "0.00"? Then it will show "0.00" if the value is 0.

I know. But I need that, if the number is zero, nothing is shown...
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby charles huff » Thu Jul 02, 2009 4:02 am

you could format the color of the zero value to be the same as the background of the field for that one case 0.00 making it invisible to the eye.

just a thought....
charles huff
 
Posts: 41
Joined: Fri Aug 15, 2008 1:24 am

Re: Hide number when zero

Postby Riccardino » Thu Jul 02, 2009 9:05 am

charles huff wrote:you could format the color of the zero value to be the same as the background of the field for that one case 0.00 making it invisible to the eye.

just a thought....


How can you do that without a calculation? Because with a calculation I can directly manage the situation of zero values replacing with blanks or nulls... :)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby Gary R. Schaecher » Thu Jul 02, 2009 3:14 pm

We had put in a new feature request for this property. You might add a request yourselves as we couldn't figure a way to do it eloquently. In Omnis, our former environment it was just a checkbox on the property sheet, 'Zeros shown empty'.

Gary
Gary R. Schaecher
TMA Systems, LLC
www.tmasystems.com
Gary R. Schaecher
 
Posts: 72
Joined: Sat Jan 06, 2007 11:01 pm

Re: Hide number when zero

Postby mboegem » Thu Jul 02, 2009 3:30 pm

What about support for conditional formatting anyway?

I dropped a feature request for this in the support system as it would be very convenient to be able to change the fontsize/color etc. of content based on a value somewhere in a (related) column.
Besides, this would overcome the need to use html for just anything you want to have formatted. (And the need to get rid of the formatting again when exporting your records as discussed last week on the forum)

I don't know if this can be done by Servoy from a technical point of view.

Are there other people out there who'd be pleased to have this possibility?
If so this might persuade the Servoy Support guys to add this... :D
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Hide number when zero

Postby Riccardino » Thu Jul 02, 2009 9:22 pm

What about support for conditional formatting anyway?

I dropped a feature request for this in the support system as it would be very convenient to be able to change the fontsize/color etc. of content based on a value somewhere in a (related) column.
Besides, this would overcome the need to use html for just anything you want to have formatted. (And the need to get rid of the formatting again when exporting your records as discussed last week on the forum)

I don't know if this can be done by Servoy from a technical point of view.


Hmm, if you're thinking something similar to FileMaker's conditional formatting, I think it's hard to have in Servoy: FM formatting are a sort of metadata, while Servoy's formatting are real informations, stored in a colum or coming from a stylesheet.
Anyway, the dev team keeps on surprising me, so... why not? :-)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby mboegem » Fri Jul 03, 2009 8:31 am

mboegem wrote:Hmm, if you're thinking something similar to FileMaker's conditional formatting


Guilty! :) Yes, that's where the idea came from...
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Hide number when zero

Postby Ron » Sat Jul 18, 2009 9:13 pm

Is it possible to make the bgcolor of a field e.g. red in case the number = 100, with html.
I have 2 records in listview with only one numberfield, displaying 100 (in record1) and 50 (in record2).
I can get it to work in recordview, but not in listview and tableview.

Thanks,
Ron
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Re: Hide number when zero

Postby ROCLASI » Sat Jul 18, 2009 10:15 pm

Hi Ron,

Yes it's possible.
What does your code look like that doesn't work?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Hide number when zero

Postby Riccardino » Sat Jul 18, 2009 11:15 pm

Ron wrote:Is it possible to make the bgcolor of a field e.g. red in case the number = 100, with html.
I have 2 records in listview with only one numberfield, displaying 100 (in record1) and 50 (in record2).
I can get it to work in recordview, but not in listview and tableview.


A calc field returning di html code should do the trick.
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Re: Hide number when zero

Postby Ron » Sun Jul 19, 2009 12:40 am

@Robert:
This is my code:
for ( var i = 1 ; i < forms.tweede.controller.getMaxRecordIndex() ; i++ )
{
forms.tweede.controller.setSelectedIndex(i)
if (forms.tweede.getal == 10)
{
forms.tweede.elements.ccc.bgcolor = '#FF3366'
}
}

@Riccardino:
This calculationfield code does'nt work:
'<html><body bgcolor="#FF3366">' + getal + '</body></html>'
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Next

Return to Forms

Who is online

Users browsing this forum: No registered users and 4 guests

cron