Graphics

 View Only
  • 1.  Text Formatting

    Posted 11-02-2016 20:39
    Is there a way to take a number from a datalinq that doesn't have commas in it (such as: 14920) and through visual logic get it to reformat it with commas in the appropriate places (such as: 14,920)?

    Thanks


  • 2.  RE: Text Formatting

    Posted 11-03-2016 04:34
    Hi,

    Yes, it is possible. It might take a bit of fiddling, but you can use the string nodes for that. You can select different parts of strings (left, middle, right) and concatenate. I don't have visual logic in front of me to give you specifics, but you'll find it all in the Strings section in the right-hand sidebar.

    James.
    #XPression


  • 3.  RE: Text Formatting

    Posted 11-03-2016 07:53
    I recently built something similar, but I realized that it only worked for a set number of digits (seven to nine) and when I tried to make conditions for longer or shorter numbers, I failed. I could post an image of the first logic tomorrow afternoon if that would help.
    #XPression


  • 4.  RE: Text Formatting

    Posted 11-03-2016 15:28
    You can do this in scripting. Right click on the text object and choose "Edit Script Events". Add this script to the OnSetText event. Code:

    text = FormatNumber(Text)


    Hit F7 to compile the script.

    That should do it.
    #XPression


  • 5.  RE: Text Formatting

    Posted 11-03-2016 19:25
    That scripting worked, but added a decimal and two zeros after it. Any way to do away with that?

    #XPression


  • 6.  RE: Text Formatting

    Posted 11-03-2016 19:32


  • 7.  RE: Text Formatting

    Posted 11-03-2016 19:52
    Thanks so much!
    #XPression