Graphics

 View Only
  • 1.  Datalinq through Scripting

    Posted 20 days ago

    Hi All,

    I've used this form before to create some scripts for setting datalinq's on text objects in Xpression, and I have one example I can't get working:

    for i as integer = 1 to 30
        Dim textObj as xpTextObject
        Dim dl as xpDatalinq
        
        scene.GetObjectByName("INJURY FULL NAME " & i, textObj)
            textObj.LinkName = "NBA Injury Report - All Teams"
            textObj.Column = "players<" & i & ">" 
            textObj.Row = "PlayerID"
    next

    The info is coming from a JSON that has the index in the column as opposed to a usual row. I can see that the script is using the correct datalinq info, but the index in the column is constantly defaulting to 1. Is it possible to change the index as an integer for the column through scripting? Thanks for all the help!



    ------------------------------
    Ben Kessler
    Orlando United States
    ------------------------------


  • 2.  RE: Datalinq through Scripting

    Posted 19 days ago

    yes this line here looks correct to me

    textObj.Column = "players<" & i & ">" 

    it is not working for you?



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



  • 3.  RE: Datalinq through Scripting

    Posted 19 days ago

    Hey Simon,

    It seems to be defaulting to the first index with that script, I tried hardcoding in "players<2>" in the script but appear to be getting the same result.

    I'm not sure if where I place the script matters, I've tried moving it around to online, preview render, and onset text but no luck so far

    Do you know if it might have anything to do with the column datalinq property?



    ------------------------------
    Ben Kessler
    Orlando United States
    ------------------------------



  • 4.  RE: Datalinq through Scripting

    Posted 19 days ago

    I think the format for datalinq is more like this;

    textObj.DataLinq.LinkName = "PlayerData"
    textObj.DataLinq.Column = "FirstName"
    textObj.DataLinq.Row = 5
    textObj.DataLinq.Table = "Roster"


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



  • 5.  RE: Datalinq through Scripting

    Posted 19 days ago

    Does this mean that the row is the index, or that the row is the only section that is able to be moved on to the next index through scripting? I'll try a few different methods to see if I can get it working on my end



    ------------------------------
    Ben Kessler
    Orlando United States
    ------------------------------



  • 6.  RE: Datalinq through Scripting

    Posted 19 days ago

    No you can index anything, I just don't think your script is quite right if you look at mine.

    textObj.DataLinq.Column



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



  • 7.  RE: Datalinq through Scripting

    Posted 19 days ago

    I've managed to get it working with some datalinq's that are excel sheets using your script, but I'm still having trouble making it work with datalinq's from JSON based API's, where the row is a string value and not a number. Is it possible for the row to be a string in scripting, could this be what is stopping it from loading?



    ------------------------------
    Ben Kessler
    Orlando United States
    ------------------------------



  • 8.  RE: Datalinq through Scripting

    Posted 19 days ago

    just got it working with a script I found on the forum a few years ago (just need to make sure the text objects are published):

    for i as integer = 1 to 50
     
    dim takeitem as xpTakeItem
    dim template as xpPublishedObject
    dim dl as xpDatalinq
     
    engine.Sequencer.GetFocusedTakeItem(takeitem)
    takeitem.GetPublishedObjectByName("INJURY FULL NAME" & i, template) 'whatever your text object name is
    template.GetDatalinq(0, dl)
    dl.LinkName = "NBA Injury Report - All Teams" 'whatever your datalinq name is
    dl.Column = "players<" & i & ">" 'whatever your column path is
    dl.Row = "playerName" 'whatever your row path is
    dl.Table = "" 'whatever your table name is
    template.SetPropertySourceType(0, 1)
     
    next


    ------------------------------
    Ben Kessler
    Orlando United States
    ------------------------------



  • 9.  RE: Datalinq through Scripting

    Posted 17 days ago

    The other method definitely works as well I use it a lot. 



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



  • 10.  RE: Datalinq through Scripting

    Posted 17 days ago

    For my sanity I did a quick test as I do it a lot with no issue, the problem with your script is what I said a little earlier up. 

    You need to use textObj.DataLinq.Column or textObj.DataLinq.Row etc

     



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