Graphics

 View Only
  • 1.  xpDatalinq Object example

    Posted 06-21-2016 21:56
    Hi all,

    I am pretty new to vbscript, and I was hoping someone could provide a simple example of how to access and change certain properties of the xpDatalinq object. The specific goal is to be able to change the row of a Datalinq'd excel sheet linked to a text object from with a script.

    I know this is probably very wrong:

    onSetText:
    dim Datalinq as xpDatalinq
    Datalinq.Row = "4"

    Thanks!


  • 2.  RE: xpDatalinq Object example

    Posted 06-22-2016 08:04
    You are very close ! I can try my code for now, but try this :

    Consider MyText as an xpTextObject of your scene


    Dim MyDataLinq as xpDatalinq
    MyDataLinq = MyText.datalinq
    MyDataLinq.row = "4"

    #XPression


  • 3.  RE: xpDatalinq Object example

    Posted 06-22-2016 21:59
    Awesome, that worked like a charm, thank you! Is there a function to force the datalinq info to update? I want to loop through a few 'columns' of data, store it, and the place it in separate text boxes. Here is what I have so far, but I am wondering if I need to force the datalinq object to update.


    dim txt as xpTextObject
    dim txtOut as xpTextObject
    dim myData as xpDatalinq
    dim statsArray(2)
    dim x as integer
    dim i as integer

    ' text object is datalinqed to excel file
    self.GetObjectByName("statfield", txt)

    ' text object that the final data will be placed on
    self.GetObjectByname("txtOut", txtOut)

    ' datalinq object
    myData = txt.datalinq

    'force dataline to row 1
    myData.Row = 1

    'loop through 3 columns of data in the excel file
    for i = 0 to 2
    ' add 4 to i because of how my excel file is offset
    x = i + 4
    ' increment column
    myData.column = x
    ' store data in the array
    statsArray(i) = myData.value
    ' increment i ... do I need to do this in vbscrip?
    i = i + 1
    Next

    ' combine data and output to text object
    txtOut.text = statsArray(0) + statsArray(1) + statsArray(2)


    #XPression


  • 4.  RE: xpDatalinq Object example

    Posted 06-23-2016 00:38
    the xpScene object has a RefreshDatalinqs method that forces the scene to re-query all it's datalinqs.

    Note that this function is asynchronous so the datalinqs will be queried in the background and update the text objects when the datalinq server returns the data.

    #XPression


  • 5.  RE: xpDatalinq Object example

    Posted 08-03-2016 17:28
    We are doing something similar - in our scene "OnOnline" and "OnPreviewRender" scripts (identical to each other), we are taking a text field that is set by a widget (a team code) and setting the datalinq key value to that team code.

    There's another text field that is set to read that datalinq property to get the team nickname, and it works great when you put the scene online. However, it does NOT work for previews.

    We ARE doing the XpScene.RefreshDatalinqs() call (or rather "Selt.RefreshDatalinqs" in those functions), but it still only renders the correct team nickname when we take it, not preview it.

    Any suggestions?

    #XPression


  • 6.  RE: xpDatalinq Object example

    Posted 08-04-2016 00:13
    Yes that approach won't really work for preview; since the preview renders before all the refreshed data comes back from the datalinq server. The preview system does not know that you just requested new data from within a script.

    The next version of XPression (6.7) already has a new feature to allow this. There is a new script event called OnPrepare that runs before the datalinq data is queried the first time; so you can modify the datalinq properties and the preview will properly reflect the new data you are requesting.

    I can't give any timeline for when 6.7 will be released to the general public, as we just finished officially releasing 6.5. It will probably be a couple of months. It is currently available to beta customers however.

    #XPression