Graphics

 View Only
Expand all | Collapse all

Replace multiple values

Malcolm Thorpe

Malcolm Thorpe06-19-2019 15:42

Pierre Valliere

Pierre Valliere06-20-2019 17:14

Malcolm Thorpe

Malcolm Thorpe06-20-2019 20:32

Malcolm Thorpe

Malcolm Thorpe06-22-2019 15:17

  • 1.  Replace multiple values

    Posted 06-18-2019 15:10

    Hi, I receving a datalink with 6 values (names) but I want to replace them.

    Ex.

    Parti Liberal to PLQ

    Parti vert to PV

    Coalition Avenir to CA

    etc...

    I can replace one of them with Replace, but I want to replace them all in the same txt.



  • 2.  RE: Replace multiple values

    Posted 06-18-2019 16:32

    Do the texts come in separate values or all at once? Would you have to sort through several words to find "Parti Liberal" or are the various political parties all that is expected? A simple script could easily replace "Parti Liberal" with "PLQ", but it would get more complicated if all the names and parties were in a long text field. What is feeding your datalinq? 


    #XPression


  • 3.  RE: Replace multiple values

    Posted 06-18-2019 16:50

    Hi Malcolm, I've found the solution. It's not in a text only values, separate value. I've Replaced one value, them after replace the second one, etc... in visual logic. And put each fonction block one after the other. What scrip I could use (i'm not that good in scripting…)


    #XPression


  • 4.  RE: Replace multiple values

    Posted 06-18-2019 17:07

    Text = text.replace("old text', "newtext")

     

     

    if text = "Parti Liberal" then

    text = "PLQ"

    elseif text = "Parti Vert" then

    text = "PV"

    elseif text = "Coalition Avenir" then

    text = "CA"

    end if


    #XPression


  • 5.  RE: Replace multiple values

    Posted 06-18-2019 17:08

    Place this on the text object that is connected to your datalinq. To add more just ad another elseif but don't add any end if. Be sure to compile the script or it won't work. Bon Chance


    #XPression


  • 6.  RE: Replace multiple values

    Posted 06-18-2019 18:30

    If type this, but we're u want me to copy it? In the objet of my text?

    Text = text.replace("old text', "newtext")

    if text = "Coalition avenir Québec" then text = "CAQ"

    elseif text = "Parti libéral du Québec" then text = "PLQ"

    elseif text = "Parti québécois" then text = "PQ"

    elseif text = " Québec solidaire" then text = "QS"

    end if

     


    #XPression


  • 7.  RE: Replace multiple values

    Posted 06-18-2019 19:33

    Right click on the text object in your scene that will be accepting the data. Look for "Edit Script Event" and paste the text into the box that comes up. Also near the top is an orange arrow sort of icon. This is "Compile" and must be done before the script will work. 


    #XPression


  • 8.  RE: Replace multiple values

    Posted 06-19-2019 15:35

    there is a mistake in the very first line of the code. "old text' should read "old text" (single quote on first example is wrong)


    #XPression


  • 9.  RE: Replace multiple values

    Posted 06-19-2019 15:41

    Hi Malcolm, Thx, I saw it. And it works! Thx a lot.


    #XPression


  • 10.  RE: Replace multiple values

    Posted 06-19-2019 15:42

    Excellent. Happy to help.


    #XPression


  • 11.  RE: Replace multiple values

    Posted 06-19-2019 20:14

    Hi Malcolm, last question : This text/script i'm replacing will be use in a concatenate block in Visual logic. It seeams that I can't apply a script to a datalink block in visual logic. Right?  My only choice is to apply my script it to a text layer? 


    #XPression


  • 12.  RE: Replace multiple values

    Posted 06-19-2019 20:17

    the conatenate block might make problems for you. I'm not sure. Yes, this script belongs on the text object that is accepting the data. perhaps the script will run first, then the concatenate.


    #XPression


  • 13.  RE: Replace multiple values

    Posted 06-20-2019 16:01

    Thx, it's working. In visual logic.

    In my script, is there a script that I could write to block all others values?

    For exemple, if someone write Québec solidaire my value will be CAQ, but if someone write Québec solidaire du parlement my value will be CAQ du parlement. I don't want others values to appears.


    #XPression


  • 14.  RE: Replace multiple values

    Posted 06-20-2019 16:14

    Pierre,

    Here's a scene that uses radio buttons to select the value.

    https://transfer.rossvideo.com/f/f2b811d92c99d54a


    #XPression


  • 15.  RE: Replace multiple values

    Posted 06-20-2019 16:23

    Pierre,

    If I understand you, I think you can just add another else if for each example you are expecting. You would replace text just like the other lines in the code.


    #XPression


  • 16.  RE: Replace multiple values

    Posted 06-20-2019 16:25

    My values are coming from a database from users "I cannont control" :) they can type eveything they want.

     

    I just need a script that say something like this :

     

    elseif text = "soemthing else" then text = ""


    #XPression


  • 17.  RE: Replace multiple values

    Posted 06-20-2019 16:28

    I think you can put an else, not an else if at the end that would basically say:

    end if (this is after all the possibilities are done)

    else text = ""

    end

     

    I would have to give it a try here to make sure it works. But the logic is there.


    #XPression


  • 18.  RE: Replace multiple values

    Posted 06-20-2019 17:14

    It's logic ;) Thx, it's working!

     


    #XPression


  • 19.  RE: Replace multiple values

    Posted 06-20-2019 20:32

    Excellent. I'm happy to help.

     


    #XPression


  • 20.  RE: Replace multiple values

    Posted 06-22-2019 14:58

    Malcolm I have sort of a similar problem. I have using datalink for data from a baseball game (daktronics). Daktronics gives me a star "*" in the data field to represent the top or the bottom of the inning or if anyone is on base. 

    I am trying to understand a solution in Visual Logic to replace these values with the associated artwork layer to make it visible  but just not getting there. It would also need to be updated (in this case the "scorebug") live, without refreshing the bug.    

    Can you give me some ideas please?

     

    Thanks!

     


    #XPression


  • 21.  RE: Replace multiple values

    Posted 06-22-2019 15:08

    Glenn,

    You could use a string compare block. Set up an invisible text object that is *. Then you can set up string compare blocks for each of the data fields that would check to see if the field is an "*". If it is you could turn on the visibility of your graphics layer. Or you could do it via a quick script on each of the data fields. I will lay out an example of both and upload them.


    #XPression


  • 22.  RE: Replace multiple values

    Posted 06-22-2019 15:17


  • 23.  RE: Replace multiple values

    Posted 06-22-2019 15:19

    I just threw this together. I haven't tested it. The values might be in reverse order on the input selector.


    #XPression


  • 24.  RE: Replace multiple values

    Posted 06-22-2019 15:34

    Here is the script you would add to each of the text objects that are taking data from your daktronics via datalinq. you would rename "objectname" to the name of your object you want to turn on or off. Be sure to "compile the script" before you try and run it. Thanks to Brian Ford and Amber Barnett I have become quite a fan of scripting, though I'm not very good at it.

     

    Dim object as xpBaseObject

    Scene.GetObjectByName(“objectname”,object)

    if text = “*” then
    object.Visible=true
    else
    object.Visible=false
    end if

     


    #XPression


  • 25.  RE: Replace multiple values

    Posted 06-22-2019 19:14

    Malcom not sure if I am doing this correctly ... or in the right place for this code. However, I am getting multiple errors when compiling ... your thoughts?

     


    #XPression


  • 26.  RE: Replace multiple values

    Posted 06-22-2019 19:36

    Off the top of my head: "awayatbat" is what I assume to be a quad with a custom material applied. This would be an arrow, or a graphic that says "At Bat". This object isn't published because the material doesn't change. the script has to be applied to the text object that is linked to a datalinq field that is fed by your daktronics feed. It is either a blank field, or an "*". Can you take a snapshot of the errors? It will tell you which lines need to be looked at. Reach out to me at malcolm.thorpe@utahjazz.com


    #XPression


  • 27.  RE: Replace multiple values

    Posted 07-08-2019 15:47

    Hi Malcolm,

    I'm receiving this message since I've enter my script in my show.

     


    #XPression


  • 28.  RE: Replace multiple values

    Posted 07-12-2019 16:35

    Pierre, I was at a conference and just saw this. If you reach out to ross tech support they can tell you what is going on. This one is out of my league.


    #XPression