Can I some way format a float value that is a part of a label

Hi

I try to make labels from Geometry_Area property in Thematic mapping. That works OK but I like to round of the values th just square meters  --and not with 6 decimals as they are now

Thanks

Erik

Parents
  • Erik,

    For your label text string, you should be able to use the [System.Math.Round([Geometry_Area],2)] expression as shown in the following...

     ...to perform the desired rounding, where n in [System.Math.Round([Geometry_Area],n)] indicates the number of digits after the decimal that are desired.

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff

    Sorry to say, but when I enter [System.Math.Round([Geometry_Area],2)] I get the area multiplied with one million.

    So instead of 777.476031 I get 777476031 and it makes no difference if I ask for any other number of digits :-(

    So what goes wrong

    Erik

  • ...what product (e.g. Bentley Map, Bentley PowerMap etc...) and version are you using? Could you please send me directly a copy of a design file containing some instance data which is producing this result? Also include details on what language and regional settings are being used.

    Regards,

    Jeff Bielefeld [Bentley]



  • Hi Jeff

    You just pointed out the root of the problem: Regional setting!

    If I change that from Danish to English the Round function works just as expected!

    But that does not help me much!

    I can't change the Regional settings on all our computers because they also run other software that relay on proper Language and regional setting.

    Most technical software runs only decimal point and do not care about regional settings for decimal seperation sign.

    And in  VBA it a mix (or a mash): Format function do use the regional setting but function Val do not -so one have to always replace "," with "." after formating.

    So what would be the best solution?

    Since Geometry_Area allways is created with "." a configuration setting or variable telling PowerMap that is should ignore the regional setting ?

    Thanks

    Erik

Reply
  • Hi Jeff

    You just pointed out the root of the problem: Regional setting!

    If I change that from Danish to English the Round function works just as expected!

    But that does not help me much!

    I can't change the Regional settings on all our computers because they also run other software that relay on proper Language and regional setting.

    Most technical software runs only decimal point and do not care about regional settings for decimal seperation sign.

    And in  VBA it a mix (or a mash): Format function do use the regional setting but function Val do not -so one have to always replace "," with "." after formating.

    So what would be the best solution?

    Since Geometry_Area allways is created with "." a configuration setting or variable telling PowerMap that is should ignore the regional setting ?

    Thanks

    Erik

Children
  • Erik,

    Are you using Bentley PowerMap V8i (SELECTseries 1) and if so what specific version? Using "Dutch (Netherlands)" regional settings with a recent Bentley Map V8i (SELECTseries 1) 08.11.07 build on the MicroStation V8i (SELECTseries 2) 08.11.07 platform, the originally suggested [System.Math.Round([Geometry_Area],2)] label text string expression seems to work as expected in my local testing as shown in the following:

    We will continue to investigate this issue, but you may be able to solve your immediate needs by using following expression... 

    [System.String.SubString("[Geometry_Area]",0,(System.String.Length("[Geometry_Area]")-System.String.IndexOf("[Geometry_Area]", ".")-1))]

    ...which simply performs a substring extract, but not true numeric rounding.

    Regards,

    Jeff Bielefeld [Bentley]