Graphics

 View Only
Expand all | Collapse all

Visual logic for various decimal point values

  • 1.  Visual logic for various decimal point values

    Posted 08-13-2019 19:33

    I have a question about visual logic for decimal points.

    I am running a script connected to a data source (RSS feed) that populates values in text fields according to a company symbol that is entered.

    In most cases I want the value to display 2 numbers after the decimal point.

    In some cases I want the value to display 5-8+ numbers after the decimal point.

    Is there a way to make one text field display different amounts of numbers after the decimal point according to the company symbol input (through Visual Logic or script)?

    I know how to make individual fields display different amounts of numbers by using the "Format Float" box, but I do not know how to tie them into a variation to one field.

    Any help would be greatly appreciated.  Thank you.



  • 2.  RE: Visual logic for various decimal point values

    Posted 08-14-2019 19:04

    Could you do a logic switch script(sort of like an else if loop for each logo) that looks at logos and then turns on visibility of one of the two text fields that has a "format float" visual basic block?

     


    #XPression


  • 3.  RE: Visual logic for various decimal point values

    Posted 08-14-2019 19:31

    I'd be willing to try, but I'm not well versed in scripting.  Do you have an example that I could try?


    #XPression


  • 4.  RE: Visual logic for various decimal point values

    Posted 08-14-2019 19:35

    I think I can work something up for you to show you how it might work. Can you show me how the logo is in the data stream?


    #XPression


  • 5.  RE: Visual logic for various decimal point values

    Posted 08-14-2019 20:04

    It's actually not logos, but values from an RSS feed (values indicating net change of a stock)

    If the company symbol is /6B, I want the value to display 5 numbers after the decimal point.

    If the company symbol is /6J, I want the value to display 8 (or 9 if possible) after the decimal point.

    For all other company symbols, I want the value to display 2 numbers after the decimal point.



    Here are 2 snips with the script and what I am trying to do, I hope this helps.  Thank you for your help.


    #XPression


  • 6.  RE: Visual logic for various decimal point values

    Posted 08-14-2019 20:06

    Got it. I can't make any promises but I will get started on this. Will you know what values to expect when it comes to the company identifiers? Is there a list you are looking at or do they come in randomly? The way I was thinking of doing it you would have to know what is coming before you could do the arguments. Will you be looking for 6A, 6J and so on?


    #XPression


  • 7.  RE: Visual logic for various decimal point values

    Posted 08-15-2019 16:28

    For the most part we will know.  The producers enter the company symbols through inception based on what companies are being discussed in that particular segment/show.  My thinking through visual logic was to have a blind text option (a default of 0 = 2 places after decimal point [most company symbols], 1 = 5 places after decimal point [/6B] and 2 = 8 or 9 places after decimal point [/6J]).  This way they would only have to change the blind text for the /6B and /6J instances.  I hope this makes sense.


    #XPression


  • 8.  RE: Visual logic for various decimal point values

    Posted 08-15-2019 22:40

    I'm producing baseball for two nights but I can dive into this on the weekend. Don't put all your eggs in one basket. I think I can get this one but feel free to seek help on the forums.

     


    #XPression


  • 9.  RE: Visual logic for various decimal point values

    Posted 08-20-2019 13:49

    Update:

    I was able to find a way to manually change the display of the amount of numbers after the decimal point by using Visual Logic and a "blind text" input. This will work for me for now, but I would still love to find a way to use either Visual Logic, scripting or both to allow a producer to just type in the company symbol and have the text field display the corresponding amount of digits after the decimal point.

    (Corrected Visual Logic added at 12:44pm Central)


    #XPression


  • 10.  RE: Visual logic for various decimal point values

    Posted 08-20-2019 16:28

    This is kind of what I was thinking. If you put this on the scene it would look at the places input (2-5 in my example) and turn on or off certain text fields based on the decimal selected. Let me know if this could work for you and I can flesh it out. Sorry for the delay.

     

     

    dim ticker as xpTextObject

    dim places as xpTextObject

    dim twoplace as xpBaseObject

    dim fourplace as xpBaseObject

    dim fiveplace as xpBaseObject

    self.getObjectByName("DECIMAL SELECT", places)

    if places = "2" then

    twoplace.visible = true

    fourplace.visible = false

    fiveplace.visible = false

    elseif places = "4" then

    twoplace.visible = false

    fourplace.visible = true

    fiveplace.visible = false

    elseif places = "5" then

    twoplace.visible = false

    fourplace.visible = false

    fiveplace.visible = true

    end if


    #XPression


  • 11.  RE: Visual logic for various decimal point values

    Posted 08-20-2019 16:48

    Hello Mark,

    good work with your visual Logic.

    Starting from what you have done, here is maybe a way to do the switch test from company input value :

     

    Hope it helps.


    #XPression


  • 12.  RE: Visual logic for various decimal point values

    Posted 08-22-2019 13:54

    Malcolm - 

    I put this script in but I'm sure I'm not doing something correctly because I couldn't get it to work. Looking at the script, however, it looks like I would still need to input a number (amount of numbers after the decimal) to display.  If that is the case, I think I will opt to go with the Visual Logic that I figured out only because I am much more familiar with it and comfortable if I would have to make any adjustments in the future.  Thank you very much for your time and effort in helping me with this matter. I truly appreciate it.

    Mignon -

    Thank you as well for this example of Visual Logic.  I worked with it a bit, but again, I am more familiar with how I made my example.  I will keep this as a snip and if the situation arises, will use it.

     

    Thank you both


    #XPression