QUERY - Google Sheets - filter with conditions - google-sheets

I'm trying to filter some rows of this sheet
Google sheet sample image
I'm using the following query:
=query(Jira_query!$A:$I;"SELECT A WHERE E contains '&SDP&' AND C IN ('To Do','In Progress')")
But I'm only getting this error:
Error
PARSE_ERROR: Encountered " "C "" at line 1, column 39. Was expecting one of: "(" ... "(" ...
I would appreciate some help here, thanks!

Get rid of the ampersands before and after SDP. That is a string literal and should just be sitting between the single quotes.
In addition, I don't think QUERY supports IN; instead, use MATCHES with a pipe-separated list.
Finally, you only need to reference A:E in the QUERY, since you don't reference any columns beyond E in the SELECT clause.
So try this:
=QUERY(Jira_query!$A:$E;"SELECT A WHERE E CONTAINS 'SDP' AND C MATCHES 'To Do|In Progress'")

Related

Try to use query to vlookup and filter a set of raw data

I try to run this query:
=Query({'raw_13-19'!A:G},"Select * where C ={'Keyword'!G2:G19}", 1)
But it keeps returning:
Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " <ID> "C "" at line 1, column 16. Was expecting one of: "(" ... "(" ...
I'm not quite sure why is this happening. Can anyone help?
Since the range is within {}, you need to use the other select notation 'Col1,Col2,Col3' instead of 'A,B,C'.
Also {'Keyword'!G2:G19} won't work, but you should use textjoin() instead.
Try:
=Query({'raw_13-19'!A:G},"Select * where Col3 matches '"&textjoin("|",1,Keyword!G2:G19)&"' ", 0)
If you have a header column on raw_13-19, then change , 0 at the end to , 1.
NOTE: the above will work with text fields, but if you have any issues, please share a mockup sheet so we can see the actual data scenario.

Resolve DGET function "More than one match found" error

I am trying to match a list of range with certain criteria in a google spreadsheet. I am using DGET function for the same. Everything is working fine but the problem comes when there are many entries that contain the whole string and I receive "More than one match found in DGET evaluation.".
For the better understanding look below:
Sheet "Form Responses 1":
B
-------
Ronald
Ronaldo
Ronaldinho
Rebarto
Matching sheet entries:
A
------
Ronald
Rebarto
Juhino
My Formula is:
=DGET('Form Responses 1'!B:H,"Date",{"Email Address","Logging In or Logging out ?","Date";A2,$B$1,$H$1})
Now the problem is Ronald is matching with "Ronald","Ronaldo" and "Ronaldinho" and I am receiving the error which says "multiple entries found".
How do we solve this?
I solved the problem by Concatenating a constant variable before and after the name. For example Ronaldo becomes mRonamdom and Ronald becomes mRonaldm. This makes the Names Unique and solves the problem.
If you don't want to modify the data but to fix the formula so it doesn't get confused with similar entries in your database parameter you can add a character to the criteria field of the dget function as shown below (I'm using an '=' sign concatenated to the value I want to match with in the database parameter)
=dget(database!$A$1:$B$11,$M$1,{"columnName";"="&F2})
where
A1:B11 is my database
M1 is the matching column name
and "="&F2 is the field with the caracter I chose that I want to match with to retrieve values from the matching database column, now even if the there are more than one matches found (becuase matching substrings"), the addition of the caracter contatenated with the matching value, should take care of the in-accurate error.

How to encode # in Azure Logic Apps OData Orderby Query?

I have an Excel Online (Business) spreadsheet with a 'Box #' column. I am using the Excel "List rows present in a table" connector and I would like to order by the "Box #" column.
However, when I try to enter it, I either get a syntax error or a column not found error.
"Box #": Syntax error '#' not allowed at this position.
"Box_x0020_#": Syntax error '#' not allowed at this position.
"Box_x0020__x0025_": Column not found.
"Box x0025": "Syntax error at position 11 in 'Box x0023"
Does anyone know how to properly encode the '#' character for use in an OrderBy clause of a SharePoint Logic App Connector? Or better yet, the missing online reference.
try x0023 instead of x0025
x0025 is % according to
https://abstractspaces.wordpress.com/2008/05/07/sharepoint-column-names-internal-name-mappings-for-non-alphabet/

Access array element use JSqlParser

I insert this sql into JSqlParser:
select count(distinct case when split(vir_name,"\\/")[OFFSET(0)] in ("G-Ware","RiskWare","Tool","PornWare","Trojan") then apk_name else null end) as black_apk_n from table1
and get error:
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
at line 1, column 13.
It may has something to do with array access issue, how to manage the same thing in JSqlParser?
Unfortunately JSqlParser does not yet support these Array constructs. In fact it supports for historical reasons SQLServers and MSAccess bracket quotation like [COLUMN] instead of "COLUMN".
Here is a discussion about this: https://github.com/JSQLParser/JSqlParser/issues/677.

Joining more than two WHERE statements in Query Language

So I am trying to use a simple QUERY function in Google Sheets where I want to select based on TWO parameters. Simple logic, and documentation says use the AND operator. The problem is I am searching for text via Cell Reference.
So here is my function
=QUERY(A1:D6,"select A where C='" &K1&'"" & "and D='" &K2"'")
Unfortunately it throws up an ERROR. I understand that Cell References that are text based need to be in single quotes (which themselves need to be in double quotes), but I am unable to join two WHERE statements.
What is the right syntax for this?
Very close indeed, please try:
=query(A1:D6,"select A where C='"&K1&"' and D='"&K2&"' ")
Welp! I was missing an concatenation symbol (&) at the end of the final cell reference K2.
=QUERY(A1:D6,"select A where C='" &K1&'"" & "and D='" &K2&"'")

Resources