Graphics

 View Only
  • 1.  How to edit a Datalinq string using Visual Logic

    Posted 01-27-2015 20:27
    Hi all,

    I'm trying to edit a datalinq string to display only the first name of the string. My Datalinq is sending John Doe. I want to only display the first name. Is this possible with Visual Logic. I've tried the RIGHT STRING and LEFT STRING functions; but they required a characted amount. Also the TRIM function don't allow to specifiy "up to character". Since the first names will be variable lengths, I'm at an imapasse.

    Anyone have success with this using Visual Logic?


  • 2.  RE: How to edit a Datalinq string using Visual Logic

    Posted 01-28-2015 15:53
    Hi Steve, currently there're no Visual Logic blocks to split strings nor finding a substring. Here's a script that will do what you're looking for:

    dim textObject as xpTextObject

    Scene.GetObjectByName("FirstName", textObject)

    textObject.Text = Split(Text, " ", 2)(0)

    [put that script in OnSetText of the datalinq'd text object, and the script assume there's a text object with the name "FirstName" where you want to the first name to be displayed]

    [If you are looking for the last name (i.e. everything after the first space) you can use: Split(Text, " ", 2)(1)]

    #XPression


  • 3.  RE: How to edit a Datalinq string using Visual Logic

    Posted 01-28-2015 17:36
    Hi Billy, thank you for the quick reply. I followed your instructions but it doesn't seem to work for me. I copied to OnSetText. Made sure the object names matched; and I got the green checkmark after I compiled.

    I'm actually getting an error when I send scene to program.

    Exception Class: EListError

    List index out of bounds (3).

    Not sure what i'm doing wrong.

    #XPression


  • 4.  RE: How to edit a Datalinq string using Visual Logic

    Posted 01-28-2015 21:05
    I just realized I should'd encoded the code in a code tag before I post. My browser decided to get fancy and changed my quotation marks from normal double quote " to left/right double quotes " ". Please check your code to see if it's showing the normal double quotes.

    dim textObject as xpTextObject

    Scene.GetObjectByName("FirstName", textObject)

    textObject.Text = Split(Text, " ", 2)(0)


    #XPression


  • 5.  RE: How to edit a Datalinq string using Visual Logic

    Posted 01-29-2015 02:21
    You can do the whole thing with just one line of code like this.

    `Text = Split(Text, " ", 2)(0)`

    #XPression