Order History in Firebase

No Never Tried with MySQL!

I don’t know if it will help you.
What you’re trying to do is what relational databases are made of.
1-Table Customers
2-Table Orders
3-Table Ordered Items

Table And with an SQL command joining the 3 tables, you filter all purchases from 1 customer and by initial and final period with the “where” and “and” clause.

Only 1 comand Select SQL

Thank you @Rogerio_Rios , Well i never tried MySQL so I don’t know much about it! But let me look into it and give it a try!

But it’ll be more helpful if I’m able to do it in Firebase since my all app data works with firebase.

1 Like

My question is why dont you store all the details in the same fb as below…


So you can easily track the user along with product and date.

Also you can use googlesheet to store these details, and can show the ordered item as a list manner along with date and time as below Screenshot_4

Very simple process only.

@Still-learning i have tried this!

But connecting this to Google sheet is something i didn’t know about!

Seeing your answer i think i can track user order by Date

Q.1 Do you know how do i connect firebase with Google sheet?

Q.2 and also if i do like this

Then data will be replaced when user order another item

So kindly let me know how do i create a Nesttag(/child) that will not replace anything present already !

Thank you

@knkiranjoshi , In such cases, you can try with firebase append value an,

Please click here for how to use firebase append


Thank you @Still-learning for Q.2 I’ll try this

Now i left with only one Q.1

I have searched for sync data between Firebase & google sheet

Got this :

But I’m not a developer so it’s hard to understand :sweat_smile:

@knkiranjoshi no need to connect firebade with Google sheet… The moment you store the value in firebase, same time you store the user details in googlesheet

@knkiranjoshi , to send the datas to googlesheet, follow this link

Heya @Still-learning after trying everything works great!

But I’m stuck with one issue now!

Bucket : 24-02-2021 (date)
Tag : 0000000000(mobile)

So Every time i click on [Order History] instead of showing all orders it only shows one order!

So to solve this problem i came up with idea of adding +1 behind the Mobile Number

Ex. Bucket: 24-02-2021/000000000
Tag : 0000000000+1

It works when i manually enter it!

So the problem is I’m unable to do it automatically
I mean, when user order first time it should store data as tag 0000000001 and same user order for second time it should Store data as tag 0000000001+1= 0000000002

I have tried with initialize global but don’t know how to do it!

Thank you

Is firebase accepting this much of zero in front? I guess you can try someother

instead you can use pattern like this,

If he order first time , count the order and store in the firebase as a “Order1:Mobile”, second time order mean tell firebase to store “Order2:Watch” like that…

I’m using mobile number instead of “zero”, I’ve used it here to give an idea

Exactly but ! How do i do that?

Like order1 for second order Order1+1= Order2?

Then use tinyDB and firebase combo

First order save it as a tag 00001 in fb and tinyDB
Second time while he order call tinyDB to read the existing tag, if it finds then upon ordering save it as tag 00002(use maths block in tag to sum it. likewise set up rule

This might work!

But what if the user uninstall the app & after sometime reinstall, then tinyDB will loose it data and we will be back to zero!

Thats why when ever screen initialise call the firebase and store latest ordertag it in the tinyDB

Alright! Let’s try again with this!

Thank you so much @Still-learning :relaxed:

blocks (1)

blocks (3) blocks (4)


assume 2323 is a mobile number :wink:

it goes like this, worked well
i have uploaded the blocks just to confirm that what i have done is correct or not,
P.S. still working on how to store tinyDB data to Firebase when screen initialize.

thank you @Still-learning

very simple @knkiranjoshi , When the screen initialize call the tag (phone number as a list) from the firebase also get it lenght using the block length of the list and retrieve the last tag(that is the length. Ie. While retrieve if it says length 7 mean retrieve the 7th list value using the block Select list item list Index7 and store that value in tinyTB.

All will take place matter of seconds… So when user confirms the order it will be easy for you to store the his nth item in the firebase also in app.