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