Decimal place S’abonner

0
Avatar
Digvijay

If my excel file shows data like
1
1.2
0.5
Then I would like the label to show it as
1.00
1.20
0.50
I want to increase the decimal place values. Kindly help

3 commentaires

0
Avatar
Pete Thane
Actions pour les commentaires Permalien

You probably don't need to use VB. 

Go into the Properties of your label field and highlight the Data Source in the column on the left. Now click on the Data Type tab and use the drop down to change the Type from the default Text to Number and that should sort it as the default for numbers is 2 decimal places.

0
Avatar
Javier Martinez Gonzalez
Actions pour les commentaires Permalien

How can i do it in the 8.01 Version?

0
Avatar
Pete Thane
Actions pour les commentaires Permalien

I have not used 8.01 for a number of years and no longer have access to it. I know the screens have changed since 8.01 but have you checked all the Data Source screens and tabs to see if the Number sub-type is available?  If so you can do it as above.

If not you will need to use the FormatNumber VB command using something like

  • Move your data field off the side of the label and give it a ShareName from one of the Data Source screens (I see to recall this was accessed via one of the tabs), For the code below I have given it a ShareName of NumberBase
  • Add a new field on the label where you want the result to go and make this field a VB Script, Event Controlled Script
  • Press the VB editor button and and on the first screen (AutoSelectedEvent) give the field a default value such as Value = "9.99"
  • Now scroll down to the OnNewRecord event and add a command similar to the below in the box, 

Value = FormatNumber(Format.NamedSubStrings("BaseNumber").Value,2)

NOTE: Type n the "Value = FormatNumber(" and then select the ShareName from the Named Data Sources list, which can be found near the bottom left of the screen I think, to add part of the code and then type the ",2) " after that.

 

Vous devez vous connecter pour laisser un commentaire.