Graphics

 View Only
  • 1.  Auto Sort Election Results & Ideas/ Suggestions

    Posted 10-08-2015 22:11
    Hi everyone,

    Up here in Canada we are hold a federal election October 19. We plan to show results from our local 3 riding's. What is the best way for displaying election results in Xpression? Further to that if I just make text boxes how can I have the 6 candidates automatically sorted by total votes; as the night goes on all we have to do is enter vote numbers and xpression will sort and display candidates with most votes at the top and least votes at the bottom, is that even possible. Our station is a very small operation, we have a very basic version of Xpression v4.0 (no extras like MOS, datalinq etc...) we have upgrade support still, is this something that could be done with a newer version of Xpression?

    Any ideas or suggestions on what we could do differently would help. Unfortunately our company isn't wiling to put more money in so am having to make things work with the software that I have.


  • 2.  RE: Auto Sort Election Results & Ideas/ Suggestions

    Posted 10-13-2015 17:16
    What system is feeding you the election data?

    #XPression


  • 3.  RE: Auto Sort Election Results & Ideas/ Suggestions

    Posted 10-14-2015 21:10
    It will be through a national results website. We will have to manually enter the data.

    #XPression


  • 4.  RE: Auto Sort Election Results & Ideas/ Suggestions

    Posted 10-14-2015 22:04
    Here's is a script that should work. Unfortunately I don't have an example of it in a project. Let us know if that's enough to go from or if you need some help implementing it.

    dim names(14) as string ' holds names

    dim party(14) as string ' holds parties

    dim scores(14) as double ' holds scores

    dim scorestxt(14) as string ' holds scores as a string

    dim txtobj as xpTextObject

    dim highest as double ' highest score found in loop

    dim highestIdx as integer ' index of highest score

    dim i as integer

    dim j as integer

    ' Get the names and scores from the page and store into local variables

    for i = 1 to 11

    if self.GetObjectByName("Name " + CStr(i) , txtobj) then

    names(i) = txtobj.text

    end if

    if self.GetObjectByName("Party " + CStr(i) , txtobj) then

    party(i) = txtobj.text

    end if

    if self.GetObjectByName("score " + CStr(i) , txtobj) then

    scores(i) = CDbl(txtobj.text)

    scorestxt(i) = txtobj.text

    end if

    next

    ' Display in sorted order.. Loop over 6 text fields

    for j = 1 to 11

    highest = -1

    highestIdx = 0

    ' Scan for the highest score remaining to be shown

    for i = 1 to 11

    if scores(i) > highest then

    highest = scores(i)

    highestIdx = i

    end if

    next

    ' Set the score to -1 so it won't show up again

    scores(highestIdx) = -1

    ' Update the text fields on the page

    if self.GetObjectByName("Name " + CStr(j) , txtobj) then

    txtobj.text = names(highestIdx)

    end if

    if self.GetObjectByName("score " + CStr(j) , txtobj) then

    txtobj.text = scorestxt(highestIdx)

    end if

    if self.GetObjectByName("Party " + CStr(j) , txtobj) then

    txtobj.text = party(highestIdx)

    end if

    next



    #XPression


  • 5.  RE: Auto Sort Election Results & Ideas/ Suggestions

    Posted 10-16-2015 01:14
    Thanks! :)

    I may need some help implementing this, I'm pretty new to the scripting side of Xpression.

    #XPression