Order History in Firebase

Hello!

I’m working on kind of online shopping app for which i need to show Order History

Currently I’m using 2 different Fb Database components & 2 Different database (in Firebase Console)

Both Database save the same Details but with the different Pocket/Tag Name ex. Fb.1 Username/orderData & Fb.2 Date/orderData

when user Click on [Order History] button it will only get the Fb.1 Username/order Data and show it in list view (i do get some errors here but i think it’ll get solved in near future)
And i can see the order History with date in Fb.2 Date/orderData inside Fb Console

Here’s where i need your help!
Is there anyway to store all users order history data in only 1 Database? And show it in list view according to the username? And also i can see the new orders according to the date?

(If i use Fb.1 Username/orderData as a single database then I’ve to check every user to get their latest order, atleast in my knowledge!)

P.S. i have used airtable to store data but it is limited to only 1200 records & i tried to use Google Sheet but couldn’t properly understand scripts and all

There’s this but, not that much help! :

Thank you

Did You Try with Mysql ?

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…

Screenshot_3

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
Screenshot_3

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

https://community.kodular.io/t/firebase-db-append-value/54204/5

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: