Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tariq Mehmood
  Where is Tariq Mehmood?
 BAHAWALPUR
 Pakistan
 Tariq Mehmood
 To: onytoo
  Where is onytoo?
 Padang
 Indonesia
 onytoo
 Tags
Subject: RE: Numeric Format in Grid
Thread ID: 311216 Message ID: 311230 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Wednesday, June 29, 2011 9:01:43 PM         
   


> > Dear Experts
> >
> > Table1 has only one numeric field as n(8,3) and data in this field is as
> >
> > 1.000
> > 1.200
> > 5.658
> > 157.658
> > 5.000
> > 148.657
> > 9.000
> > 5.658
> >
> > I want to display this column in grid as
> >
> > 1
> > 1.2
> > 5.658
> > 157.658
> > 5
> > 148.657
> > 9
> > 5.658
> >
> > What dynamic format should I use?
> > Or is there any other method?
> > (Single digit if there is no decimal)
> >
> > Please help
>
>
> This is simple solution using DynamicInputMask:
>
>
> thisform.Grid1.Column1.DynamicInputMask = ;
>   [IIF((ctable.num%1)>0,] + ;
>   ['9,999.'+REPLICATE('9',LEN(LTRIM(RTRIM(STR((ctable.num%1)*1000),0,'0')))),'9,999')]
> 
> *!* OR
> 
> thisform.Grid1.Column1.DynamicInputMask = ;
>   [IIF((ctable.num%1)>0,] + ;
>   ['9,999.'+REPLICATE('9',LEN(LTRIM(RTRIM(STR((ctable.num%1),8,3),0,'0')))-2),'9,999')]
> 
> 

>
>
> If your grid is editable then:
>
>
> *!* Grid1.Column1.Text1.GotFocus
> this.InputMask = [9,999.999]
> 

>
>
> Regards,
> Onytoo

Thanks Sir,

Following procedure works fine for me

thisform.Grid1.Column3.DynamicInputMask = ;
  [IIF((closing.open_qty%1)>0,] + ;
  ['9,999.'+REPLICATE('9',LEN(LTRIM(RTRIM(STR((closing.open_qty%1),8,3),0,'0')))-2),'9,999')]


But.......

How to hide 0, zero value?

ENTIRE THREAD

Numeric Format in Grid Posted by Tariq mehmood @ 6/29/2011 7:02:12 PM
RE: Numeric Format in Grid Posted by Borislav Borissov @ 6/29/2011 7:13:37 PM
RE: Numeric Format in Grid Posted by onytoo @ 6/29/2011 8:11:30 PM
RE: Numeric Format in Grid Posted by Tariq mehmood @ 6/29/2011 9:01:43 PM
RE: Numeric Format in Grid Posted by onytoo @ 6/29/2011 9:30:04 PM
RE: Numeric Format in Grid Posted by Tariq mehmood @ 6/30/2011 5:36:49 AM
RE: Numeric Format in Grid Posted by Jun Tangunan @ 6/30/2011 6:16:12 AM
RE: Numeric Format in Grid Posted by Tariq mehmood @ 6/30/2011 6:19:23 AM
RE: Numeric Format in Grid Posted by Jun Tangunan @ 6/30/2011 6:28:36 AM
RE: Numeric Format in Grid Posted by Manoj Patel @ 6/30/2011 7:49:14 AM
RE: Numeric Format in Grid Posted by onytoo @ 6/30/2011 8:26:33 AM
RE: Numeric Format in Grid Posted by Tariq mehmood @ 6/30/2011 1:56:25 PM
RE: Numeric Format in Grid Posted by onytoo @ 6/30/2011 5:01:06 PM
RE: Numeric Format in Grid Posted by Tariq mehmood @ 6/30/2011 7:36:17 PM
RE: Numeric Format in Grid Posted by onytoo @ 6/30/2011 11:38:27 PM