Generate a flutter list from a Cloud Firestore query - dart

I am trying to generate a list containing the 'name' parameters as Strings from this Firestore.instance.collection('videos').limit(10).snapshots(); query, but I am having trouble extracting the parameter values from the documents and returning them as a list. Would I have to use .forEach() or do I have to .map() the entries to a list? Any help would be highly appreciated!
Edit: Additionally I would like to query the documents in a certain range, but .startAt() does not seem to accept integers. Is there any way to query say the first 10 documents by using Firestore.instance.collection('videos').startAt(0).limit(10).snapshots();?

There is an example of doing this using a StreamBuilder at https://pub.dartlang.org/packages/cloud_firestore#-example-tab-

Related

I can't figure out how to transpose unique values based on specific critera in Google Sheets

I'm trying to create an inventory system for my business. For example, our SKU codes start with "LMS" "RSP" and "CON" for specific locations where we're working.
I'm trying to take all unique "LMS" codes, and copy them to a single sheet from our raw scan data. I've tried variations on REGEXMATCH, and UNIQUE, and TRANSPOSE, IF statements, and , but I'm totally lost. This is not my normal preview.
For example, I've been trying things like:
=FILTER(RAW!B2:B,RAW!B2:B=UNIQUE(RAW!B2:B),REGEXMATCH(RAW!B2:B,"LMS"))
and
=IF(REGEXMATCH(RAW!B2:B,"LMS"),(TRANSPOSE(RAW!B2:B)),"error")
The second example returns all values in RAW!B, while the first one does nothing. Any help would be appreciated.
Try below formula-
=UNIQUE(FILTER(Raw!B2:B,REGEXMATCH(Raw!B2:B,"LMS")))
Or QUERY() function with wild card match-
=UNIQUE(QUERY(Raw!B2:B,"select B where B like 'LMS%'"))

Firestore query passing in an array of String - Firestore - Swift

I have an array of UIDs (String) and I want to perform a query using Firestore where I get all the documents in which the field "uid" is equal to any of the ones in the array provided.
Till now I tried doing:
ref.whereField("uid", in: uidArray)
But this doesn't work and gives me an error because the maximum number of elements in the array must be 10 and it surely surpasses that limit.
My question is: how can I achieve the same result with a workaround using Firestore?
Whenever I try to implement a query using this DB it seems it's built for making developers' lives harder.
Yes, according to the docs, the maximum number of elements in the array is 10. To be able to get over this limitation, you should perform successive calls. For example, if you need to check a field against 35 values, then you should perform 4 queries. Three queries with the 10 elements and the fourth with 5 elements. Lastly, you should combine the result on the client.

Update query array with addition or deletion of sheets

I'm new to coding and have been trying to find some help but may not have been searching the correct terms so I would appreciate any direction I can get!
I am using a query in multiple locations with different criteria but the same array for all. I am looking for a way for the query array to be updated as sheets are added or removed from the spreadsheet without having to do it manually each time. I would need to leave out certain sheets. This is an example of the query I am using below.
=IFERROR(QUERY({'Test Location 1'!C6:P;'Test Location 2'!C6:P;'Test Location 3'!C6:P},"SELECT Col11,Col14 WHERE Col4='Working On It' and Col5='Yellow Station'",1),"")
Test Sheet

QUERY function not including text cells along with number cells in result

I'm currently trying to copy a list using the QUERY function in google-sheets.
The problem im now facing is that words / letters are not included in the search.
Example picture
Im using the function: "=QUERY(E2:F5;)" but don't get the words included.
Is there any way to include these words by using the formula above as guide?
In google-sheets, use Format, Number, Plain Text on your source range of E2:F5 and your original formula will work.
=QUERY(E2:F5)
From Docs Editor Help - QUERY function
In case of mixed data types in a single column, the majority data type determines the data type of the column for query purposes. Minority data types are considered null values.

Is it possible to replace the value of a sessionVariable in mule for each iteration

I am trying to retrieve some values from the database. Out of which one field is encoded by base64. I need to produce the result by decoding that field. When the Database returns multiple rows as the result I am not able to fetch the decoded value for all the rows. I am using a foreach scope and iterating within the payload and saving the result in a SessionVariable. I am able to save the first row's decoded value. Other all row's values are printed as same as in the Database. Could someone help to resolve this.
i would suggest not to use sessionVars for each iterator...create a POJO equivalent to the Database and then create a ArrayList of that POJO. This will help in the performance as well as in logic.
The problem is the way you are using mule
mule <base64-decoder-transformer/>
ideally in you case it should be inside the for-each loop.

Resources