Firebase real-time database substring query [duplicate] - firebase-realtime-database

This question already has answers here:
How to query firebase keys with a substring
(2 answers)
Firebase query - Find item with child that contains string
(1 answer)
Firebase get all usernames & user Id starting with user entered character
(3 answers)
How to get all elements whose id contains a particular substring?
(1 answer)
Closed 5 months ago.
I am going to look up with keyword substring "vi" for key "full_name". How can I do that?
[{
"full_Name": "David Beckham",
"email": "davidbeckham#gmail.com"} ,
{
"full_Name": "Cristiano Ronaldo",
"email": "critinanoronaldo#gmail.com"
}]
Thank you.

You can do something like this to order and query based on a certain key
dbQuery.orderByKey().startAt(SUBSTRING).endAt(SUBSTRING+"\uf8ff");
For more info you can look at the official documentation
https://firebase.google.com/docs/database/rest/retrieve-data#range-queries

Query firebase key with a substring is possible
let node = await db.ref('yourPath').orderByChild('full_Name').startAt('!').endAt('SUBSTRING\uf8ff').once('value');

Related

Replace cells content based of different conditions [duplicate]

This question already has answers here:
How can I create a conditional that puts a value in one cell if there is certain value in another cell in Google Sheets
(1 answer)
Frustrating Formula - Help Needed with Google Sheets formula/method
(2 answers)
Closed 4 months ago.
imagine I have a column with a list of brand, how can I search for different brand name and replace their name with anoter label automatically?
If it was only 1 condition, I could do
IF(REGEXMATCH(LOWER(B27), "nike"), "Sport Shop", B27)
but what if I have 2 or more conditions-label to apply?
Here is an example:
Ideas?
Thanks

replacing character in google sheet [duplicate]

This question already has answers here:
Substitute first X occurrences
(2 answers)
RegexReplace the nth occurrence of a string of underscores
(1 answer)
Reference - What does this regex mean?
(1 answer)
Closed 4 months ago.
I am wondering in google sheets if it is possible to replace the second character.
ex. abc123/def123/ghi123
I want to replace the second slash after def123 to a colon. So I want it shown as abc123/def123:ghi123
Thanks!

Some data removed after query [duplicate]

This question already has answers here:
Query is ignoring string (non numeric) value
(2 answers)
Closed 5 months ago.
I have a google sheet https://docs.google.com/spreadsheets/d/1mUV9DpVJHC2UbyqOG49wUIRj3EflTlB9etJQFssRLvo/ with a column "Floor", it contains the number and also character, I want to query the column and remove all empty cell, =unique(query(A:A,"SELECT A WHERE A IS NOT NULL ORDER BY A")) only the number be queried and all characters have been removed.
Can anyone advise how I can query all with unique and sort function?
I read the article from https://webapps.stackexchange.com/questions/101778/google-sheets-query-wont-display-cell-text-if-other-cells-have-numbers and come up a solution, hope this can help others.
=UNIQUE(ARRAYFORMULA(QUERY(TO_TEXT(A2:A), "SELECT Col1 WHERE Col1 IS NOT NULL ORDER BY Col1")))
Reason of using TO_TEXT() because mixed data types in a single column in Google Sheet, the majority data type determines the data type of the column for query purposes, so I convert all into text format.
Ref: https://support.google.com/docs/answer/3094285?hl=en
UNIQUE is used to filter out all duplicated values
Regarding ARRAYFORMULA() function, I don't know why it is needed but QUERY() will return #VALUE! if missing the ARRAYFORMULA().
If someone can explain the use of ARRAYFORMULA() and Col1 reference, appreciate to answer.
use the filter function instead.
considering Column A has both numbers and characters.
in B2, write: =filter(A2:A,isnumber(A2:A))
let me know if you need help!

Split string and append single quotes in rails [duplicate]

This question already has answers here:
How do I convert a comma-separated string into an array?
(4 answers)
Closed 3 years ago.
Front End Request
?date_filter=2019-03-12,2019-03-13
As you see, I am passing two dates in request from front end to ruby controller.
I want to convert those dates into below format so that I can use them in my SQL query
Expected Result:
['2019-03-12', '2019-03-13']
First get the query string data, then do the split on it, it will result an array of the values.
dates = request.query_parameters['date_filter']
result = dates.split(',')
result would be ['2019-03-12', '2019-03-13']
Let a be the query parameter you get the to get the required result use
a = "2019-03-12,2019-03-13"
a.split(",") //gives ["2019-03-12", "2019-03-12"]

Get cell number of the first empty column [duplicate]

This question already has answers here:
Find the first empty cell in the same column/row
(3 answers)
Closed 5 years ago.
I'm trying to get the first cell that is empty in a column but I don't have an idea how to accomplish that.
For example, I have this column
How can i get for example in A:7 that the first empty cell is 5 (i only get the number)
I tryied this, but is giving me a error
In A7 enter the array formula:
=MIN(IF(A1:A6="",ROW(A1:A6)))
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.
EDIT#1:
Here is the Google Sheet equivalent:

Resources