Tagging the experts:
@Mihaly_Toth @Fred_Kuzyk @Mevi @Harri_Sarsa1 @Kaushik_Bhattacharya @Eduardo_Manus
Not sure if anyone knows the answer. But let me try my luck.
I’ve been trying to figure out how to run firestore db queries for a while now and I dont seem to arrive at a solution by my own, anytime soon. So a little help will go a long way for me.
This is my problem:
I’m able to acheive until the part where I see the response for the POST request. But I’m totally blank as to how I should bind the response to a data variable such that I can use it with the ‘repeat with’ property
What am I trying to do?
I’m trying to query firestore db for a collection named ‘users’ in the field ‘name’ for the value ‘Stacey’.
The request is a post request and returns a list of documents in the response. I want to be able to display all the users under the name of ‘Stacey’ using the ‘repeat with’ property
Weekend here with a little time so trying to help but you’ve lost me at ‘POST request’.
Anyway, I’d simply use a Get Record Collection flow function and use the filter with a dynamic binding:
name = [your_dynamic_input]
The dataVar attached to this flow function will return a list which you can use in your ‘repeat with’ binding.
Thank you so much for taking your time.
Firestore queries needs to be sent on a post request. Traditionally, we use GET requests to retrive data. But, since queries need to be structured, POST request is absolutely essential.
Appgyver doesn’t seem to have native support to use POST requests as a mean to retrive data. This means, I couldn’t use the repeat with property to display the response to the user.
My problem is same as this one:
But this guide is not too friendly with the problem I’m facing since a lot of it is based on the 2020 edition of Appgyver.
I’ll let you enjoy your weekend. If you find a little bit of time, please help me with this.
Happy weekend :)))
If you are looking to use SQL style query on firestore data, try RunQuery - refer firebase documentation.
I’ve never needed to use REST API and http requests for getting data from firestore. I can’t help with that.
I’ve however always got what I wanted with AppGyver’s built-in
Get Record Collections.
But maybe I don’t understand your issue…
Hi! I’m clear about the methods of running queries and getting responses. I’m stuck with the part, where I’m required to store the response from POST request such that, it can be used with ‘repeat with’ property.
I’m actually in desperate need for a solution as I promised a client delivery by Monday (tomorrow)
You have an Indian name, so it’s safe to assume you are from India. If you have the time, please email me at firstname.lastname@example.org. I’ll be more than willing to pay for your time and mentorship
How else do you run firestore queries without using REST API?
You must reference the output of the POST HTTP RunQuery inside a SET DATA VARIABLE flow (formula binding).
should be available. Composer might say it’s not compatible, but it will match the schema of the respective data variable, provided the query returns an OK 200 response.
Hope this helps. Good luck!
It may be helpful if you can provide more detail on what you are looking to accomplish. If your data record is configured properly you should be able to use the above advice and use the get record collection function which would enable you to repeat by the documents in the collection. You can skip some of the stuff in the below video, but I use the data item in repeat in this video you just need to filter by the name instead of filtering in order by data.
I thought firestore was a nosql database (below)?
Hi @Dhanushkkar_H ,
it works like @Bruno_Oliveira described and like you found it under step 8 in the guideline.
In general to debug your code I would recomend to start with a verification of what you have.
- With the function Encode_JSON and an alert flow function you can check, if you really receive the data from the http-request flow function.
By the way: Don’t know why you assume that the guideline referes to a 2020 version → it was created (and posted) in 2022…
That’s where I’m stuck. I have 2 questions
When you say create a data variable, do you mean an ON-device storage resource? If I do that, then will every response get stored in it?
How exactly do you structure it for firestore responses? Please help me out here
“stringValue”: “Amazon Prime 1 month”
I want to store the price, email_id and item_id. How would you go about implementing this?
An abstract guide for my case will help me use it as a referance.
Thank you so much for your time >>>>
@stayfoolish @Surface_Level @Bruno_Oliveira @Kaushik_Bhattacharya
In its simplest form you can create a collection in appgyver and repeat with the documents in that collection, where each document is the value you want to repeat. I posted a video above, about half way through that i show how to repeate a text component with documents from a firebase collection.
If you want to show the data to users, i just made a different video on showing single api records. This may help you as it shows how to get data and save it as a variable from a record (below).
Hi, just to be clear: I’m clear with the basics of appguer such as repeating a data resource.
What I don’t understand is, how do you do the same thing with a HTTP request flow function?
Like, I want to send a POST request to a URL and I want to store the response somewhere like an app variable so that i can use ‘repeat with’ to display every doc in the response.
I want to query firestore DB for a value. It returns,say, 10 documents that satisfies my query. How do you display this 10 documents?
The traditional approch would be to setup a data resource and setup a data variable that corresponds to that.
I’m trying to do the same thing with the HTTP flow function
Hope this helps to understand my concern better :))
Should this data variable be a On-device storage resource?
The complicated way would be to map the repsonse to variables you store. I think the easier way is to confifure the data resource like you would for a repeated component, then store the values from the givwn records.
So, these are the steps I followed:
- using the GET COLLECTION method, i created a data resource named ‘test’ and saved the schema for it
- I made a HTTP request using the flow function and bound the value of the output to approprite fields
- I used repeat with
- It does’t work.
Because,while creating a data resouce, I’m giving it a URL. When I use repeat with, it’s repeating the data from the URL not the data resource I created.
I just couldn’t wrap my head around it
Can you build the resource url using the data resources section? You can use the url placeholders to build a custom url then pass the details from the app to compelte the url.