Firestore composite index not loading in console - google-cloud-firestore

firestore().collection("clinic").doc("+911111111111").collection("appointment")
.where("dentistPhoneNumber","==","+911111111111")
.where("timestamp", "<", end)
.where("timestamp", ">", start).get()
Trying to create this index for firestore but link given out at terminal is not loading
Retried many times and tried loading it in incognito window too.
Any suggestion how to go about it ? Originally wanted to query whole collectionGroup of appointment but it gave the same error .

Related

Paginate firestore query while still listening to new documents

As many others, I have an app with chat functionality. I have a StreamBuilder<QuerySnapshot> that listens to new chat messages, and a ListView.builder that shows them. I'm looking for a good way to paginate the messages, but none of the solutions I have found works for me, since I always have to listen to new messages.
One of the things I tried was this code, but that didn't seem to work even if the author said he had updated the code.
Each chat message has it's own document in a collection, so right now I just fetch all the documents in the collection and order them by a time field. However this only works for about 20 messages before performance suffers, so I would be very glad if someone could help me with this.
I guess you are showing the messages sorted by creation date, right? Why dont you paginate using the date then?
chatcollectionref.
where("creationdate", "<", enddate)
... // Add more conditions if needed
.orderBy("creationdate","desc").limit(20).get()
Start with enddate far in the future then update it to the creation date of the last message you retrieve and just paginate.
EDIT: a bit more details...
First run of the query: enddate = new Date(2100, 1, 1) and you get the first 20 messages and display them
The user scrolls down and reach the last message
Run again the query: enddate = creationdate of the last message you have already retrieved, and you get the 20 next
Loop back to 2
Works well in my chat app

Can't get data from a single field in firebase RTDB using Flutter

I am trying to read data from Firebase RTDB using flutter but can't seem to get the value from a specific child.
I have a drop linked to the Car field in my database which works fine and pulls the value:
After pressing a button, I am trying to run a query to get the Brand linked to the car select using the following:
void CreateNewDeal(String selectedcar) {
try{
print('check car inside function - $selectedcar');
FirebaseDatabase.instance.reference().child('CarList2').orderByChild('Car').equalTo(selectedcar).once().then((DataSnapshot snap) {
print('${snap.value['Brand']}');
});
}catch(e){
print('error in reading the brand');
}
}
I keep getting a null on the print statement.
If I, however, change the print statement to remove the `['Brand]' it retrieves the full tree for the specific node.
How do I only retrieve the 'Brand' for the corresponding 'Car'.
EDIT:
I tried to run the code with just $snap.value and this returns the whole tree for the specific child. when I then change the print to print(snap.value[0]['Brand']) it then prints the Brand if I were to select the Car linked to item 0 in the tree. If I change this to any other Car selected in my dropdown, it does not give me the Brand and returns a null. I though maybe it was related to the 0 index so I purposefully selected item 1 and changed the print to snap.value[1]['Brand'] but this does not work either.
This cannot possibly be null because when I physically check the database, values are present. and i am unsure as to why it works for item 0 and not for nay other item
EDIT
The reason i was experiencing this issue is because of the way my tree was setup. i did further investigations and eventually had to change the indexes as seen above in my tree screenshot.
see my other question and answer below as to how to restructure the tree if need be.:
Flutter - Firebase RTDB read issue for node at index 0, 1 and 2
This is linked to incorrectly setting up the database. you must use indexes. please see my other question which point to the way to do it
Flutter - Firebase RTDB read issue for node at index 0, 1 and 2

Unable to get form to open to an existing record

When my application first opens, I have an Autoexec Macro set to open a small form (frmGrantNo) in a window that asks for a grant number, the field for the grant number opens blank (Data Entry = On). This works.
Next I want to manually enter an existing Grant Number from my table (tblGrant), and open another form (frmInfo) to the grant number I manually entered.
So far, if I manually enter an existing Grant Number, I can’t get it to take me to that record in the frmInfo form, it opens to the first record in the table.
I have tried a Button Wizard for a Go To Record Button and I get the error “The command or action “Find” isn’t available now”.
I have tried a macro that opens the table (tblGrant), then Got To record, then Open Form (frmInfo) and it opens the table in datasheet AND the frmInfo Form, but to the first record, not the one I entered.
I have tried event procedures that I found online, but none of them work as I still don’t quite understand more than the basic VB commands.
I have looked here for help but I may not be working my questions right becuase I haven't found anything to help.
Any help would be greatly appreciated. ~ Thanks
You want something like this:
DoCmd.OpenForm "frmInfo", WhereCondition:="GrantNumber = " & Me!GrantNumber
in the button event procedure. It filters the opened form to the grant number you entered. Adapt field names for your table and form.

no such table error : CacheGroups, Caches, Origins, DeletedCacheResources

when login through facebook for first time am getting no such table error even if table exist.(It works fine for normal login)
In logcat am getting these errors(for first time alone):
SQLiteLog (1) no such table: CacheGroups
SQLiteLog (1) no such table: Caches
SQLiteLog (1) no such table: Origins
SQLiteLog (1) no such table: DeletedCacheResources
if I close the app and then reopen it and go through the same process then it just works perfectly.

Have to close my query in Microsoft Access 2013 each time I want to run a form

every time I want to run a form that searches through my database and returns results based on certain fields (login name, date, etc.) I must close out of the query if I want to change the search criteria. For example, if I search for login name "John" I get all those results, but if I then want to search for "Jerry" I have to close out of the query with the data first, then re-run the form.
Is there anyway around this?
--This applies to both Close and Opening method.
--Same applies to all the object(s) not just the query but also the Form etc.
To close a query you can use following code.
DoCmd.Close acQuery, "Queryname", acSaveNo
To explain it better,
DoCmd.Close is a method
it accepts following parameters.
What to close (object type:acQuery, acForm etc)
Name of the object (in this case Query name)
Action to perform when closing (acSaveYes,acSaveNo,acSavePrompt).
Remember: Saving is actually saving the object(in this case Query) not the data.
To Avoid Accidental modification of the query.I recommend closing the object without saving (unless required and know what you are doing)
acSaveYes: is to save the form with out notification. This is not saving the data, this is actually saving the object. So i recommend not doing this unless you want users to modify the query.
acSaveNo: This is close the query without saving.If you have users who would like to just view data and don't modify the query this is useful.
acSavePrompt: This is just prompting to either save the object or not.
Quick tip: While writing the query, if intellisense works then that means your cold is valid.
ref:https://msdn.microsoft.com/en-us/library/office/ff192860%28v=office.15%29.aspx