Announcement

Collapse
No announcement yet.

decimals showing up wrong after (clean install of OS windows)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Malosa
    replied
    Originally posted by aa6vh View Post

    I am confused as to how you got it working. "tada" is declared as a "double", but hs.writelog is expecting a string for the second parameter. So there is a implicit conversion that the compiler is doing for you, which may produce results you do not want. (There is another implicit cconversion also converting the string "638983.000" into a double.)

    I would try something like the following:

    dim tada as double = 638983.000
    dim strtada As String = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",strtada)

    Of course you paraphrased your code, so perhaps your actual code is different...
    this is actually how my code looks like...


    try to run this and let me know whats the output



    Sub Main(ByVal Parms As Object)
    dim tada as double = "638983.000"
    tada = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",tada)
    end sub

    Leave a comment:


  • Guest
    Guest replied
    Originally posted by Malosa View Post
    dim tada as double = "638983.000"
    tada = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",tada) [TABLE="cellspacing: 0"]
    I am confused as to how you got it working. "tada" is declared as a "double", but hs.writelog is expecting a string for the second parameter. So there is a implicit conversion that the compiler is doing for you, which may produce results you do not want. (There is another implicit cconversion also converting the string "638983.000" into a double.)

    I would try something like the following:

    dim tada as double = 638983.000
    dim strtada As String = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",strtada)

    Of course you paraphrased your code, so perhaps your actual code is different...

    Leave a comment:


  • Malosa
    replied
    It won' t me let edit my first post,

    I did solve it, apperantly the region settings did not work after been saved...
    i did try multiple times and i fixed it.

    SOLVED:
    Decimal symbol : .
    Grouping symbol : ,

    Leave a comment:


  • Malosa
    replied
    whatever i change in my regional settings like a comma or decimals doesnt affect anything.. homeseer keeps using the old settings.. even after restart

    Leave a comment:


  • Malosa
    replied
    Originally posted by jon00 View Post
    You could change your locale to US or UK
    i have it already on US.
    it was an other locale before
    but still no luck


    even if i try this in a script..

    dim tada as double = "638983.000"
    tada = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",tada)

    638983

    This doesnt make any sense.. so if i do this:
    tada = (FormatNumber(tada /1000000,2 ))
    hs.writelog ("tada",tada)

    638,98

    it doesn' t calculate right, normal the above first code should give 638,98 but it doesnt..


    i did also try on my other pc there it now has also the issue..
    is this an homeseer issue ?

    i was before on 531
    it does it both on 548 and hs4 v05

    Leave a comment:


  • jon00
    replied
    You could change your locale to US or UK

    Leave a comment:


  • Malosa
    replied
    Originally posted by jon00 View Post
    It looks like you have a mix of localization i.e. your Ini data is using a decimal point but your local region uses a comma.

    As the data is stored in an ini file, you can probably read the data and just use a replace statement to convert a dot to a comma before doing the math.
    thanks for the reply
    is there a way to change it easy without modify the scripts?
    i have many other scripts like this?
    It did work yesterday.

    Leave a comment:


  • jon00
    replied
    It looks like you have a mix of localization i.e. your Ini data is using a decimal point but your local region uses a comma.

    As the data is stored in an ini file, you can probably read the data and just use a replace statement to convert a dot to a comma before doing the math.

    Leave a comment:


  • Malosa
    replied
    Originally posted by langenet View Post
    Could this be related to the locale?
    i did check my localisation setting in windows and its normal..

    Leave a comment:


  • langenet
    replied
    Could this be related to the locale?

    Leave a comment:


  • Malosa
    replied
    I did another test and something is really wrong but i don't where the problem is

    When i use this code :

    dim tada as double = "638983.000"
    tada = (FormatNumber(tada /1000,2 ))
    hs.writelog ("tada",tada)
    jan-29 16:32:37 tada 638983
    This doesnt make any sense.. so if i do this:
    tada = (FormatNumber(tada /1000000,2 ))
    it shows correct...
    jan-29 16:30:21 tada 638,98


    this happens when i did reinstall windows... now all my scripts are messed up and can't use them anymore...

    Leave a comment:


  • decimals showing up wrong after (clean install of OS windows)

    SOLVED:
    Decimal symbol : .
    Grouping symbol : ,





















    Hi all

    well before my decimals show normal after my script started.
    right now they return total wrong

    this is how it should be :
    jan-22 11:43:41 current consume 0.03 kWh
    jan-22 11:43:41 current actual produce -0 kWh
    jan-22 11:43:41 low produced 635.82 kWh
    jan-22 11:43:41 high produced 1524.19 kWh
    jan-22 11:43:41 low consumed 1487.34 kWh
    jan-22 11:43:41 high consumed 900.03 kWh
    jan-22 11:43:41 Total 227.36
    jan-22 11:43:41 payment / returns -4.82€
    jan-22 11:43:41 gasTOTAL 974.81m³
    jan-22 11:43:41 Malosa P1 Updating
    right now
    jan-29 14:49:52 low produced 6389830 kWh
    jan-29 14:49:52 high produced 15256460 kWh
    jan-29 14:49:52 low consumed 15366780 kWh
    jan-29 14:49:52 high consumed 9369670 kWh
    jan-29 14:49:52 Total 3090160
    jan-29 14:49:52 payment / returns -1729272550€
    jan-29 14:49:52 gasTOTAL 10544,73m³
    This is what i have in the ini, it always work normal

    highcons = (FormatNumber(highcons /1000,2 ))
    lowcons = (FormatNumber(lowcons /1000,2 ))
    GasToTal = (FormatNumber(GasToTal /1,2 ))

    and so on...

    Am i missing something in dotnet ?
    this info is from an xml page. it worked yesterday...


    Regards
Working...
X