Graphics

 View Only
  • 1.  Xpression plug-in refreshing SQL data queries

    Posted 12-16-2020 20:20

    Has anyone had issues with the XPression plug-in occasionally not refreshing data pulled from a SQL database?  I'm tracking down an issue with an election template intermittently not refreshing data when selecting a race.  I have a dropdown of races that, when selected, performs a SQL query to Datalinq.  Most of the time the data appears correctly, but once in a while the page will be blank.  Selecting another race then going back to the previous will refresh the data properly.  The graphic seems to be functioning correctly on air, it’s just in the plug-in where it’s not refreshing.  I’m concerned that if it’s not refreshing properly in the plug-in, that could potentially cause an issue.  At the very least it could cause the end-user to be worried that it won’t make air.  Thanks for the help!



  • 2.  RE: Xpression plug-in refreshing SQL data queries

    Posted 01-13-2021 13:53

    How are you resolving the data requests, is it via scripts? Do you have any macros? Are you using any dynamic materials? Are you getting any materials from a network drive or is everything local?


    #XPression


  • 3.  RE: Xpression plug-in refreshing SQL data queries

    Posted 01-13-2021 14:51

    The dropdown ("Select Race") runs a script On Set Text to refresh a datalinq key ("RaceNumber").  The content in the dropdown comes from a datalinq source, with the race number column assigned to the textbox.

    All data sources using the race number is linked to datalinq using macros:

    To take into account that the graphic can display four candidates at a time, and many races have more than four candidates, a script runs in On Prepare to allow the user to select multiple pages within a race and have the candidate information display in the correct order:

    'declare variables
    dim selectrace, pageNum, dataObj, canNumObj, logo as xptextobject
    dim baseobj as xpbaseobject
    dim keys as xpDatalinqKeys
    dim key as xpDatalinqKey
    dim val as double
    dim fso as object

    '*****SELECT RACE NUMBER AND REFRESH DATALINQS****

    'get scene object
    Self.getobjectbyname("Select Race", selectrace)
    Self.GetObjectByName("Enter Page Number", pageNum)
    Self.GetObjectByName("Candidates Per Page", dataObj)

    'determine candidate numbers based on page number entered
    val = ((cdbl(pageNum.text) - 1) * cdbl(dataObj.text))

    'set candidate numbers
    for i as integer = 1 to cdbl(dataObj.text)
    'get scene objects
    Self.GetObjectByName("CandidateNumber_" & i, canNumObj)

    'CREATE THE CANDIDATE NUMBER BY TAKING THE PREVIOUS VALUE AND ADDING IT
    'TO WHICH CANDIDATE NUMBER WE'RE CURRENTLY LOOPING THROUGH
    'IN CASE THE NUMBER IS A DECIMAL, ROUND IT
    canNumObj.text = cstr(math.round(i + val))
    'msgbox(canNumObj.text)
    next

    'get datalinqs
    Self.GetDatalinqKeys(keys)

    'set RaceNumber dalalinq key
    keys.GetKeyByName("RaceNumber", key)
    key.AsString = selectrace.text

    'refresh datalinqs
    Self.RefreshDatalinqs

    I'm currently not using dynamic materials to set photos as we're on XPression 9, but do plan on taking advantage of that feature when we upgrade.  Currently photos are set using a script looking to images that are stored locally on the Gateways and engines (I have a feature in the template that allows to sot by winner or by party):

    'declare variables
    dim baseobj, baseobjParty as xpbaseobject
    'dim mat as xpmaterial
    'dim shader as xpbaseshader
    dim logo as xptextobject
    dim fso as object

    'create file system object
    fso = CreateObject("Scripting.FileSystemObject")

    'get scene objects
    Scene.getobjectbyname("Data_Logo1", logo)
    Scene.getobjectbyname("CandidatePhoto_1", baseobj)
    Scene.getobjectbyname("CandidatePhoto_2_PARTY", baseobjParty)
    'baseobj.getmaterial(0,mat)
    'mat.getshader(0,shader)

    'set photo
    If logo.text <>"" Then
    If fso.FileExists("D:\Candidate Photos\" & logo.text & ".png") = "True" Then
    'shader.setfilename("D:\Candidate Photos\" & logo.text & ".png")
    baseobj.SetVolatileTextureFile(0, "D:\Candidate Photos\" & logo.text & ".png")
    baseobjParty.SetVolatileTextureFile(0, "D:\Candidate Photos\" & logo.text & ".png")
    Else
    'shader.setfilename("D:\Candidate Photos\Generic Candidate.png")
    baseobj.SetVolatileTextureFile(0, "D:\Candidate Photos\Generic Candidate.png")
    baseobjParty.SetVolatileTextureFile(0, "D:\Candidate Photos\Generic Candidate.png")
    End If
    Else
    'shader.setfilename("D:\Candidate Photos\Generic Candidate.png")
    baseobj.SetVolatileTextureFile(0, "D:\Candidate Photos\Generic Candidate.png")
    baseobjParty.SetVolatileTextureFile(0, "D:\Candidate Photos\Generic Candidate.png")
    End If

    On the engines everything is recalling correctly, it seems to be only in the plug-in where it doesn't recall 100% of the time, forcing the end user to go back and forth between races to refresh the data.  Thank you for your help.


    #XPression


  • 4.  RE: Xpression plug-in refreshing SQL data queries

    Posted 01-13-2021 15:46

    The preview only renders once (unless you change something to make the plugin request a new one) whereas when you play it live it is rendering continuously. 

    My guess is it's not able to resolve everything before this preview gets rendered. 

    I had a similar issue recently and it was a combination of the following, I was using scripts to complete the query, I was also using macros to complete the query and I was using dynamic materials on a remote drive to fill the objects. I found that using macros were faster than the scripts, that at least party fixed my issue. I found that making sure all my assets were local which is looks like yours are also helped speed things up.

    After that it's a bit above my understanding level however I am more than happy to take your project and put it on my system and see if it is just a performance thing or if there's more to it?  


    #XPression


  • 5.  RE: Xpression plug-in refreshing SQL data queries

    Posted 01-13-2021 18:22

    Thank you, Simon.  If you have a spot to upload it to, I'll send it your way.


    #XPression