Formatting a Number field

Hi at all, :)

I would to create a field(number) on my form that when I insert a number like: 10000 show only 10 but into database I want to have 10000
so:

display:
10
20
30
40
12
11
database:
10000
20000
30000
40000
12000
11000

Is that possible?

Another needs is to convert a char into a number,so for example:
in a number field i want to insert “t” char and convert it into a fixed number.
I’ve tried to intercept both “onAction” and “onDataChange” event (and perform into a function the fixed-number insert) but if the character isn’t a number then no event is invoked
Any suggestion?

Thanks in advance

Marco

use a converter on the column ?

(if you are talking about the conversion from char value to a number)
Actually no,
I’ve try to put a converter but the result is the same: the global method coupled with the column converter isn’t invoked :(

It should be called ? What Servoy version and global method converter you have ?

Actually I use servoy 5.0.1 with Windows Xp.

to convert a char to a fixed value I’m trying this:

function QtyInputConverter(_value,_typeOFConversion) {
if(_value=="t")
	return -123
return _value;

but the method is invoked only if I insert a number value

ok, but why not use a string dataprovider then (if you want to input non numbers) ?

because I have a form in wich I can insert a lot of long number (es: 298325) and if possible I want to
put a special char into the field and convert it into a specific number to perform a fast input

ok, so, I have a number column, a field which has this column as dataprovider and this converter:

function globalMethod(value,type) {
	application.output('value:'+value+', type:'+type);
	if (value == 't')
		return -123;
	return value;
}

If I type ‘t’ in the field and focus out of the field I will get ‘t’ replaced with -123 and -123 is saved to database. Isn’t this what you want ?

Yes,
but in my case the method isn’t invoked!If i put “t” value then the letter became red and servoy don’t let me to focus out(and the method isn’t invoked)

This is the situation:
[attachment=0]situation.JPG[/attachment]

On the form(created by solutionModel but builded on normal datasource: server–>table) I have an field-object connected with the Qty database-field

Is there something wrong into this configuration?

I left the converted object type to “as is” and didn’t use the solution model. Maybe try in a small solution first ?

Ok! thank you! :)
By changing the object type into “as is” (like default) all working fine,the method is invoked and it done the conversion!