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?
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?
Riccardino:
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 ?
Have you tried the format “0.00”? Then it will show “0.00” if the value is 0.
lvostinar:
Riccardino:
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…
Joas:
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…
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:
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…
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
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…
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?
mboegem:
Hmm, if you’re thinking something similar to FileMaker’s conditional formatting
Guilty! Yes, that’s where the idea came from…
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
Hi Ron,
Yes it’s possible.
What does your code look like that doesn’t work?
Ron:
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.
@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:
‘’ + getal + ‘’
I tried the calcfield [Name: tekstcalculatie / returned type: tekst / displayed type: html ] and can display the number bold.
However backgroundcolor still won’t work, so it must be a wrong html code.
function tekstcalculatie()
{
if ( getal == 100 )
{
var a = ‘’ +getal+ ‘’
return a
}
var b = getal
return b
}
Hi Ron,
Ron:
@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’
}
}
As you noticed yourself you can’t set an element per row in list- or tableview. It will change all rows then.
Ron:
@Riccardino:
This calculationfield code does’nt work:
‘’ + getal + ‘’
You need to use a table to get the background color working. So your code will look like this:
function tekstcalculatie()
{
if ( getal == 100 ) {
var a = '<html><table width="100%" bgcolor="#FF5566"><tr><td>' +getal+ '</td></tr></table></html>'
return a
} else {
var b = getal
return b
}
}
It even works without table tag Robert!
Thank you (and Ric.) for your assistance.
Regards,
Ron
function tekstcalculatie()
{
if ( getal == 100 ) {
var a = ‘’ +getal+ ‘</body’
return a
} else {
var b = ‘’ +getal+ ‘</body’
return b
}
}
Ron:
It even works without table tag Robert!
Thank you (and Ric.) for your assistance.
You’re welcome. Remember that you can also use those calcs in row background colors: it’s a very useful techinque if you want to make some record stand out in a list (say: all the orders “IN PROGRESS” can have a green background etc.)
Ron:
It even works without table tag Robert!
I stand corrected