
Announcements
I'm having trouble figuring out filtering cards based on their position in the list. My goal is to automatically add a comment to the top card in a list when a file is created in OneDrive. I have everything figured out except how to filter my list of Trello cards to only apply this to the top card of a list. Any ideas?
Hi @wmosier,
As far as I am aware the List the cards in a board does not support sorting. However, as a workaround you could list all cards and figure out which card has the lowest pos value. That should be the top card. You could use a Select and Filter Array action for that.
Below is an example of that approach.
1. Add a Select action.
a. Use the body field of the List the cards in a board action in the From field
b. Switch the Map field to Text mode
c. Add the following expression to only retrieve the position values:
item()?['pos']
2. Add a Filter Array action
a. Use the body field of the List the cards in a board action in the From field
b. In the Filter use Card Position is equal to the min value of the Select. Use the expression below for that:
min(body('Select'))