Flex Repeater (Database) position change based on the tags

Show your instances binding configuration. If you're posting code then please see Wiki - how to post code on this forum.

Do you have a tag for each instance, and you want to sort the instances depending on whether or not the corresponding tag has an error ?

I have separate tag for each instances. If tag 1 have error then station 1 need to move down. Like that I have separate tag for each instances.

Sure I have linked the named query to this instance is binding

Select Station Number from stations

Show the configuration of the binding, that will give us quite a bit of information. For instance, what format is the NamedQuery using to return it's results? Is there a transform being applied (I assume there is).

Also, is there really a space in your column name? If so, I don't think that SQL is valid.

  • step 1:
    query your database
  • step 2:
    read all the tags corresponding to your data, in the same order you got them from the query.
  • step 3:
    use zip to match the tags to your data, and sorted to sort it based on the tag
  • step 4:
    extract the data back if you don't need the tag

example:

station_numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
tags = [True, False, False, True, False, True, True, False, True, False]
sorted_station_numbers = [x[0] for x in sorted(zip(station_numbers, tags), key=lambda x: x[1])]
2 Likes

Hi @lrose There is no space in the column.

Hi @pascal.fragnoud
Thanks for your information.

What the funk is that query ? Is it only a convoluted way of sorting by station number, or am I missing something ?

try

select station_number
from stations
order by station_number

By the way, this looks VERY MUCH like something from the certifications test... Is this the case ?

1 Like

Hi All Thanks for your support I have solve the case

Hi @pascal.fragnoud Thanks for your suggestions.