Graphics

 View Only
  • 1.  Rounding Decimal points

    Posted 10-26-2022 22:42
    Using datalinq to show election result vote percentage.  News producer wants the decimal to round to the nearest tenth. Basically if the percentage is 42.85 they want it to show up as 42.9
    What is the best way to achieve this?


    ------------------------------
    Tina Ludewig
    Graphic Artist
    KITV4 Island Television
    ------------------------------


  • 2.  RE: Rounding Decimal points

    Posted 10-27-2022 11:55
    Hi Tina.
    It's easy using this skript. Set it on the text object
    dim temp as double = CDbl(text)
    text=temp.toString("#.0")+"%"


    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 3.  RE: Rounding Decimal points

    Posted 10-27-2022 17:49
    The scripting did exactly what I needed. THANK YOU SO MUCH!

    ------------------------------
    Tina Ludewig
    Graphic Artist
    KITV4 Island Television
    ------------------------------



  • 4.  RE: Rounding Decimal points

    Posted 10-27-2022 13:10
    Hi Tina,

    Roma is correct, this is pretty easy to do with a script, but if you are more comfortable with Visual Logic, you can get the same result.

    The Round Function will only round to the nearest whole number so you will not be using it for this. 

    The first step would be to isolate the decimal.  You can do this with a String Position block.  You will then want to add two digits after the decimal location as you want this to show to the hundredths.  Finally, run your product from your Multiply block to a Left String block's In and the total of the String Positions and offset/Adds block into the Length of the Left String.  The out of the Left String can then be run to the final text field.


    Hope that helps,

    Rob

    ------------------------------
    Rob Blank
    Ross Video
    ------------------------------



  • 5.  RE: Rounding Decimal points

    Posted 10-27-2022 13:36
    Rob.
    If you are using VL it is better to create schema below.


    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 6.  RE: Rounding Decimal points

    Posted 10-27-2022 15:16
    Hadn't thought of that.  Nicely done!

    ------------------------------
    Rob Blank
    Ross Video
    ------------------------------



  • 7.  RE: Rounding Decimal points

    Posted 10-27-2022 17:50
    This is awesome! Thanks for the help!

    ------------------------------
    Tina Ludewig
    Graphic Artist
    KITV4 Island Television
    ------------------------------