Graphics

 View Only
  • 1.  Use Visual Logic to sort items twice?

    Posted 06-03-2022 14:22
    I'm trying to use visual logic to organize some candidates for upcoming elections. The data we get imports four candidates, two from each party. There will be two winners (one for each party).

    I don't think we can get them imported separately so I'm trying to use visual logic to organize them by putting party D on the left half and party R on the right half of the screen. I want the candidates in the lead for each team party to be on the leftmost side of their half.

    I figured I'd try using the sort block to do this by first sorting them by parties then taking those and sorting them by the number of votes. The issue I'm running into is that it only seems to sort everything by the parties, I can't get them to reorganize by the votes.

    I'm sure this is possible and I just connected or set up the blocks wrong? I attached some screenshots and a sample project I was using.

    Any help would be appreciated!

    ------------------------------
    Omar Reyes
    ------------------------------

    Attachment(s)

    xpp
    Election_Sort.xpp   473 KB 1 version


  • 2.  RE: Use Visual Logic to sort items twice?

    Posted 06-06-2022 08:49
    Can you sort/filter the incoming data? Something like

    SELECT * FROM election_table WHERE party='R' ORDER BY votes DESC


    ------------------------------
    JohnCorigliano
    Senior Software Engineer
    ISC
    ------------------------------



  • 3.  RE: Use Visual Logic to sort items twice?

    Posted 06-07-2022 05:39
      |   view attached
    You need to select number by number based on the first Sort Selector, compare numbers 2 by 2, create an order and output the first selector number after the second order.

    ------------------------------
    Gabriel Rosca
    Bucharest Romania
    ------------------------------