Topic: How To Set Format Value in tablegrid

How to edit script set format in tablegrid

-number
123456.789 to

123,456.789

-date
2016-09-14 14:39 to

14/09/2020
by year + 4

-time
14:39 to

02:39 AM
My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How To Set Format Value in tablegrid

prahousefamily wrote:

How to edit script set format in tablegrid

-number
123456.789 to

123,456.789

You should use type CURRENCY for field, where you can activate thousand separator:
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=2380&download=0


prahousefamily wrote:

-date
2016-09-14 14:39 to

14/09/2020
by year + 4

You should use calculate field, an example:

strftime('%d.%m.%Y', datefield, '+4 years')



prahousefamily wrote:

-time
14:39 to

02:39 AM

My Visual Database uses user's regional format, but if you need, you can change format in the tablegrid using script, an example:

procedure Form1_GridEmployees_OnChange (Sender: string);
var
   i,c: integer;
   sTime: string;
begin
     Form1.GridEmployees.BeginUpdate;

     c := Form1.GridEmployees.RowCount - 1;
     for i := 0 to c do
     begin
         sTime := Form1.GridEmployees.Cells[4,i];

         if sTime<>'' then
             Form1.GridEmployees.Cells[4,i] := FormatDateTime( 'hh:mm ampm', StrToTime(sTime) );
     end;

     Form1.GridEmployees.EndUpdate;
end;
Post's attachments

Attachment icon separator.png 19.95 kb, 247 downloads since 2016-09-15 

Dmitry.

Re: How To Set Format Value in tablegrid

I'm with MVD version 4.6. My table has a "Currency" field with 2 decimal places and a thousand separations. I recorded in this field the value of 243.35, but in the tablegrid it appears only 243.00.

In the sqlite table and in the textbox the value is 243.35, but not in the tablegrid.

Can anyone help? Is this a bug?

Roberto Alencar

4 (edited by derek 2018-10-17 20:32:16)

Re: How To Set Format Value in tablegrid

Hello JRGA,
It sounds as if, in the edit field on the form where you are entering your value, you have ticked the 'currency' object property.  If so, then make sure that you also set the 'accuracy' object property to '2'.  If you set the one without setting the other, the value will only show whole numbers.
Alternatively, leave both of these two object properties as their defaults ('unticked' and 0') and allow the program to use the original definitions that you specified when defining your table.
Hope this is clear and helps,
Derek.

Re: How To Set Format Value in tablegrid

jrga wrote:

I'm with MVD version 4.6. My table has a "Currency" field with 2 decimal places and a thousand separations. I recorded in this field the value of 243.35, but in the tablegrid it appears only 243.00.

In the sqlite table and in the textbox the value is 243.35, but not in the tablegrid.

Can anyone help? Is this a bug?

Please attach your project, I'll test it.

Dmitry.