A review that always “belongs” to a particular collection in Firebase


#1

Hi there. Please, I need some help to solve a problem I’m facing and if it solved can put the project development is another level. In my project To make a review that always “belongs” to a particular Retail, I followed the tutorial Restaurant guide (https://hackernoon.com/the-easiest-way-by-far-to-build-a-real-react-firebase-web-app-5dc6fa6f1b61), step by step and always double-checking if it was everything in place. Turns out that after two weeks I still struggling the make it works fine. As you can see in the print screen, the “LocalretailID” which belongs to the “Localretails” collections field is empty. What I’m doing wrong?

The query I’m using is like this
where(“LocalretailID”, “==”, “$slot(‘ds_SlotLocalretailID’)”).orderBy(“reviewDate”,“desc”)

Hope I you can help me. Thank you ver much, Marcos



#2

Hi, this probably occurs because when saving/adding the Review the data slot or property containing the LocalretailID is empty? Have you checked if this is the case e.g. b y using the Developer tools console in Chrome?

I’m guessing that the reason is somewhere in saving the data. By using the developer tools you can check real time that what every variable contains while testing the app.


#3

Thank Antti. I’ve changed the collection name and data slot as well to check if some kind of "cache is interfering. Anyway, comparing both - Retail Guide and your Restaurant guide, it looks quite the same, I mean, saving the name (ds_SlotLocalretailName) and ID (ds_SlotLocalretailsID) data slot before saving the datasheet “Reviews”. In all my tests the field localretailsID is filled with “0” or “1”. It seems that this should be easy, but I can’t find a solution and tried hard in all possible ways. :slight_smile: I appreciate your help with any help. Thanks again. Best, MarcosThank you again.


#4

Hi, try using the document_key column from Data sheet when saving the selected “Retail ID”. In the example it looks you have the DataSheetRow.key which I think is obsolete (we had to change it to document_key because “key” was reserved variable name in some cases)


#5

Great Antti. Now it worked! thank you