Graphics

 View Only
Expand all | Collapse all

Dynamically create text with Datalinq source

  • 1.  Dynamically create text with Datalinq source

    Posted 04-16-2015 18:09
    Hey all,

    I would like to dynamically create a text object, then set its data source to DataLinq. And then fill in the DataLinq information. Here is what I have:

    self.CreateObject("Text", textob)

    textob.name = "TextOBJ"

    self.SetObjectPropertyString("TextOBJ", "Data Source", "DataLinq")

    I think that sets the Data Source to DataLinq. If that works, the next thing to do would be fill in the fields for the DataLinq.

    Eventually, this would be used to make a stock list from an RSS feed.

    Is this possible or am I just hopeful?

    Thanks


  • 2.  RE: Dynamically create text with Datalinq source

    Posted 04-17-2015 02:03
    Hi John, sorry it is not possible to set a datalinq through the API or scripting.

    #XPression


  • 3.  RE: Dynamically create text with Datalinq source

    Posted 04-17-2015 04:01
    Thanks Brian,

    I was afraid of that.

    #XPression


  • 4.  RE: Dynamically create text with Datalinq source

    Posted 04-21-2022 13:25
    Has this changed in the last 7 years? I'm hoping to make a lot of our graphics more flexible by creating and destroying objects dynamically rather than having hundreds of invisible objects ready to handle data sources but would need to be able to create objects via the SDK that can then be datalinqed via the SDK. Thanks!

    ------------------------------
    Nick Huntley
    ------------------------------



  • 5.  RE: Dynamically create text with Datalinq source

    Posted 04-21-2022 13:34
    I guess so, if you look in the SDK you'll find things like datalinq.LinkName and  datalinq.Colomn

    Here's an example of a loop I am using at the moment. Row doesn't have to be there if you don't want to set something but I put it there to blank out any bogus data that had been added. 

    for i = 1 to 9

    dim stat as xpTextObject

    self.GetObjectByName("DATA RAW Jersey " & i, stat)
    stat.Datalinq.LinkName="PARAM_DASH"
    stat.Datalinq.Column="@Team.Dash@\Lineup\element<" & i & ">"
    stat.Datalinq.Row=""

    next

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 6.  RE: Dynamically create text with Datalinq source

    Posted 04-21-2022 22:22
    Sure, but that doesn't change the switch from "Static Text" to "Datalinq" at the "Select Data Source" level which is the roadblock I keep running into with this specific use case. I want to be able to create a text object, then set it to "datalinq" via API, at the moment it is stuck in "static text" when created. I CAN assign it a datalinq value but it doesn't appear to behave correctly (it seems to take the first value when first assigned but will not update past that value until it is told it is a "datalinq source" text object

    ------------------------------
    Nick Huntley
    ------------------------------



  • 7.  RE: Dynamically create text with Datalinq source

    Posted 04-21-2022 22:31
    In theory running this onKeyPress should give me the ability to take any scene object and set it to "datalinq" per the PropertySourceType enumeration:

    dim scene as xpScene
    Dim Obj as xpTextObject
    engine.GetFocusedScene(scene)
    scene.GetFocusedObject(obj)
    Scene.SetObjectPropertyString(obj.Name,"PropertySourceType",1)

    But this does nothing at the moment (propertysourcetype seems to be a sequencer-side enumeration from what I can decipher even though the controls exist on unpublished objects just as much as they do on published ones)

    ------------------------------
    Nick Huntley
    ------------------------------



  • 8.  RE: Dynamically create text with Datalinq source

    Posted 04-22-2022 06:28
    Hey Nick, I'll ask one of the devs about it. ​​

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 9.  RE: Dynamically create text with Datalinq source

    Posted 04-22-2022 12:38
    Hi Nick,
       If you need to dynamically change the datasource of a text object in a scene I don't see that being possible at the moment.  You can change all the datalinq properties of a published object of a take item including the datasource.  (I am using Xpression 10.5)

    'Change datalinq properties of a published object
    dim takeItem as xpTakeItem
    dim template as xpPublishedObject
    dim dl as xpDatalinq

    engine.Sequencer.GetFocusedTakeItem(takeItem)
    takeItem.GetPublishedObjectByName("PUBLISHED OBJECT NAME", template)
     template.GetDatalinq(0,dl)
      dl.LinkName = "NAME OF DATASOURCE"
      dl.Column = "COLUMN NAME"
      dl.Row = 88
      dl.Table = "TABLE NAME" & "$"
      template.SetPropertySourceType(0, 1)

    Another thing I do is use a scene to pull data from a datalinq source and put the value into the static text of a published object.  You cannot change the datasource, but you could have multiple text objects each assigned to a different datasource.

    Here is how I setup the text object I named excel in the scene:

    You can then update the text objects and refresh the datalinq to get an updated value.
    'Get Datalinq Scene
    dim dlScene as xpScene
    dim column, row, table, excel as xpTextObject
    dim takeItem as xpTakeItem
    dim template as xpPublishedObject

    engine.GetSceneByName("Get Datalinq", dlScene)
    dlScene.GetObjectByName("Column", column)
    dlScene.GetObjectByName("Row", row)
    dlScene.GetObjectByName("Table", table)
    dlScene.GetOBjectByName("excel", excel)

    column.Text = "COLUMN NAME"
    row.Text = 88
    table.Text = "TABLE NAME"
    dlScene.RefreshDatalinqsAndWait()
    engine.Sequencer.GetFocusedTakeItem(takeItem)
    takeItem.
    GetPublishedObjectByName("PUBLISHED OBJECT NAME", template)
    template.SetPropertyString(0, excel.Text)


    ------------------------------
    Doug Clift
    Lead Developer
    AT&T SportsNet
    ------------------------------



  • 10.  RE: Dynamically create text with Datalinq source

    Posted 04-22-2022 15:36
    Hey Doug,

    I was afraid of that still being the case. I do like your workaround though, using a scene as, essentially,  a global method to "get" data and push it (albeit static) to other scenes. I think that could work for many of our projects with some modifications. I'm still interested in seeing if there will eventually be a way to flip that one switch via the API, thats the only thing standing in the way of completely dynamic graphics that can add rows to standings pages and such. But thank you for your detailed response! Going to give that a go on a scene and see if its a good compromise.

    ------------------------------
    Nick Huntley
    ------------------------------



  • 11.  RE: Dynamically create text with Datalinq source

    Posted 04-26-2022 10:26
    Another possible work-around is to create a single, hidden text object with DataLinq enabled. Then create as many copies of that as needed, modifying the Datalinq fields as needed.
    Dim txtOrig As xpTextObject
    ' Make sure controlText has Datalinq enabled
    Scene.GetObjectByName("controlText", txtOrig)
    Dim i As Integer
    For i=1 To 5
    	Dim txtNew As xpTextObject = Scene.GetObjectCopy(txtOrig)
    	txtNew.Name = "copy" & i
    	txtNew.Datalinq.Column = "array<" & i & ">"
    	txtNew.PosY -= 50 * i
    	txtNew.Visible = True
    Next​
    This works except on my Xpression Developer v10 an error dialog box pops up for each copy. I don't know why. I haven't tried this on a production system. Maybe it will work better on a different system?


    ------------------------------
    JohnCorigliano
    Senior Software Engineer
    ISC
    ------------------------------



  • 12.  RE: Dynamically create text with Datalinq source

    Posted 02-13-2024 02:44

    With the script I can assign datalinq to my text objects. But how can I assign Datalinq to a quad object, to change the image of the objects material? 



    ------------------------------
    Bernhard Aschenwald
    ------------------------------