How to Increment a Variable Using Loop Action Output Without Reapplying Filters?

Database & APIs

I'm trying to sum the totalorder field from a list of documents in my Orders subcollection. I've set up a loop using an Action Output from a Firebase query that filters the documents by today's date.

In the loop, I want to update a variable (totalSum) by incrementing it with the totalorder field from the current document in each iteration. However, when I try to set the increment operation, FlutterFlow is asking me to "Filter List Items" again instead of just allowing me to select the totalorder field directly from the Action Output.

How can I correctly set up the loop so that I can increment totalSum using the totalorder value of each document in the loop without needing to reapply filters? Am I missing something in the setup?

Thanks in advance for the help!

What have you tried so far?
  • Firebase Query: I successfully created a Firebase query that filters the Orders subcollection to only include documents where created_at matches today's date. I stored the results in an Action Output variable (todayOrders).

  • Loop Setup: I set up a loop to iterate over the todayOrders list. In the loop, I selected the Is Set and Not Empty option to ensure I’m processing a valid list.

  • Variable Update: Inside the loop, I tried to update a state variable (totalSum) using the Increment/Decrement action. I selected the Action Output for the current loop item and attempted to reference the totalorder field.

  • Issue Encountered: When I tried to select the totalorder field from the Action Output, FlutterFlow prompted me to "Filter List Items" again, which I don’t need since the query has already filtered the data. This is where I'm stuck.

Did you check FlutterFlow's Documentation for this topic?
Yes
2
5 replies