Back

SOLVED: Rest Api multiple queries in FlutterFlow

  • 0
  • Databases
Musicien
4 Aug, 2023, 14:19

Hi there!

I'm using Flutterflow to build my app and recently I discover AppWrite. I'm getting issues when trying to query document via Api call. When I use one query, it orks. But when i try to put two queries, the second is not recognized. I precise that I use the Flutterflow API Call editor. I use the variable "queries[]" with the value "lessThan("age", 33)". It works fine because there is only one query. But I don't know how to pass two queries. I've tried all I think possible. When I try variable "queries[]" with values "lessThan("age", 33)&orderAsc("nom")", it doesnt work. Only the first query works. I've tried changing brackets and quotation marks, nothing's working. Help please!

TL;DR
The user is using FlutterFlow and is experiencing difficulties with querying documents via an API call in AppWrite. They are able to successfully use one query, but when attempting to use two queries, only the first query is recognized. They have tried various methods and formatting but have been unsuccessful. The solution is to pass multiple queries by using the format `queries[]=lessThan("age", 33)&queries[]=orderAsc("nom")`.
Binyamin
4 Aug, 2023, 14:35

What response you're getting? What version of Appwrite is it?

Musicien
4 Aug, 2023, 14:36

Selfhosted version 1.3.8

Binyamin
4 Aug, 2023, 14:38

Ohh I see You'll need to pass multiple queries Like so

TypeScript
queries[]=lessThan("age", 33)&queries[]=orderAsc("nom")
Binyamin
4 Aug, 2023, 14:38

Check here for more details

https://appwrite.io/docs/rest#query

Binyamin
4 Aug, 2023, 14:40

Btw why are you sending the Api key in the request?

Musicien
4 Aug, 2023, 14:40

I know. But How can I do this in Flutterflow. When I write lessThan("age", 33)&queries[]=orderAsc("nom") in the qeries variable, only the first query is working. When I create a second variable to pass the second query, only the first works.

Binyamin
4 Aug, 2023, 14:41

Try to multiple variables named queries[]

Musicien
4 Aug, 2023, 14:42

it cannot add two or more variables with the same name 😩

Musicien
4 Aug, 2023, 14:43

That's why I tried to add a second variable named &queries[], but it didn't work

Binyamin
4 Aug, 2023, 14:53

Yes just tested and its looks like FlutterFlow limitation about using array as aquery parameter

Musicien
4 Aug, 2023, 15:00

It's really frustrating. Appwrite is so intuitive.

Musicien
4 Aug, 2023, 15:02

Do you know if it is possible to order data in a JSON local state? I would put the first query data in a local state and then order or filter the data in the local state if possible.

Binyamin
4 Aug, 2023, 15:03

Are you talking about Flutter or FlutterFlow logic? As I'm not that familiar with the last one.

Musicien
4 Aug, 2023, 15:25

I was talking about Flutterflow. But if it is possible with flutter it would be possible with flutterflow even with custom code

jaydenclerk
4 Aug, 2023, 15:54

Vote for appwrite in the wishlist section ( community forum)

Drake
4 Aug, 2023, 16:13

fluterrflow might not let you have the same key multiple times so you can do queries[0] and then queries[1], etc

Musicien
5 Aug, 2023, 12:27

I will try and inform you

Musicien
5 Aug, 2023, 14:08

Wow!!! It works fine! Thanks a lot!

Musicien
5 Aug, 2023, 14:09

SOLVED: Rest Api multiple queries in FlutterFlow

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more