Graphics

 View Only
  • 1.  Parsing Text with Comma

    Posted 12-29-2023 16:59

    There is a recent post about parsing text via scripting. I have a similar question, but my issue is a bit different. I am pulling a name from datalinq.

    Ex. STEWART,TREY

    Here is the script I am using on the text object to delete the first name and just show the last name:

    dim list(3) as string

    'Check for a comma

    if( InStr(text,",") > 0) then

    list = split(text,",",2)

    text = ltrim(list(0))

    else

    list = split(text," ",2)

    text = ltrim(list(1))

    end if

    This script works fine for all names except for this one:

    ADAMS JR.,MARCUS

    I want the text object to read "ADAMS JR." and that is what shows in the preview window. But when I take the scene online, the text object reads "JR." only.

    Any thoughts?



    ------------------------------
    Matt Finlayson
    Brigham Young University
    ------------------------------


  • 2.  RE: Parsing Text with Comma

    Posted 12-30-2023 00:31

    This is the base script I use when I want to manipulate names with commas. This one flips first and last names. But I think that if you delete the bold portion of the script and replace the 1 with 0 (zero) it SHOULD just display the text that appears before the comma. I'm not at my Xpression so I can't really test this one. I'll try tomorrow.

    if InStr(text, ",") > 0 then

                  text = split(text, ",")(1) & " " & split(text, ",")(0)

    else

                  text = text

    end if



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: Parsing Text with Comma

    Posted 12-30-2023 15:05

    ok, never mind. I will play around a bit and send you a better script.



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 4.  RE: Parsing Text with Comma

    Posted 12-30-2023 15:10

    OK, this one works. But the script has to be on the text field accepting the data

    if InStr(text, ",") > 0 then
    text = split(text, ",")(0)
    else
    text = text
    end if


    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 5.  RE: Parsing Text with Comma

    Posted 12-30-2023 15:14
    Thanks for the help. I will try this script.
    My original script seems to be working now, after a reboot of everything. (Which is what I should’ve done before requesting the help)

    However, I will know more after tonight’s game to see if the script holds true.

    Matt Finlayson




  • 6.  RE: Parsing Text with Comma

    Posted 12-30-2023 15:18

    Excellent news. Go Cougars......Unless the U is playing.



    ------------------------------
    Malcolm Thorpe
    xpression design
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------