Requested behaviour:
I would like to create a search form in Google Sheets to query a table that I use as a database.
The user should be able to query the table by multiple searches
categories which the user can type into a cell of the sheet.
If the user does not type in a search string, then all items
should be displayed.
Also, the user should be able to choose between an
"including OR" and an "excluding AND" search.
The original table is on a different sheet than the search form. The final searchform should have more than 10 searchable categories.
Current State
Since the original table is in a different sheet than the search form, my idea has been to import the table by a dynamic query() function.
I created two input search input fields and a field where the user can switch between "OR" and "AND". I also created a query function that connects these 3 search terms.
The change between "OR" and "AND" search works (with the first approach).
First approach:
=QUERY('Geschäftsvorfälle'!A2:AG1000, "select * WHERE A="&B4&" "&D1&" B='"&B5&"'")
Second approach:
=QUERY('Geschäftsvorfälle'!A2:AG1000, "select * " &if(B5="Alle",, "WHERE B='"&B5&"'") &if(B4="",, "WHERE A="&B4&""))
Issue
The first approach works with the "OR" search but gives an empty sheet back if I use multiple search terms. It also throws a "VALUE" error if leave one search term blank. The second approach throws a "VALUE" error if I use multiple search terms even there should be matching rows.
Is there a way to make this kind of a searchform work in Google Sheets? If yes is it possible to do it with query() and how do I do it? Could you provide some example screenshots or code?
Screenshots
The searchform:
The combining query:
try:
=QUERY('Geschäftsvorfälle'!A2:AG,
"where "&TEXTJOIN(" "&D1&" ", 1,
IF(B4<>"", " A="&B4, ),
IF(B5<>"", " B='"&B5&"'", ),
IF(B6<>"", " lower(F) contains '"&LOWER(B6)&"'", )), 1)
Related
I am creating a line chart in a CloudWatch dashboard. I can create a line representing the frequency with which one string appears the logs, using a filter. But, I don't know how to create two or more such lines.
After selecting a log group, I run this query:
filter name = "first log string"
| stats count(*) as firstString by bin(1hour)
This generates counts of results that, in the Visiulization tab, are displayed as a line chart with a single line.
Now I want to add another line representing "second log string" on the chart. I assume I will have to modify the filter in some way, or add a second filter.
Here are some things that don't work:
adding a second name to the filter
trying filter #message or #name as this documentation suggests
simply pasting in a modified duplicate of the query
Further, I seem to lack documentation that explains how filter is supposed to work. Search engines keep sending me back to this Filter And Pattern Syntax AWS document which dosen't appear to give any actual examples using filter.
To answer my own question, I had to use an array in my filter. I also used the sum() function instead of count().
filter name in ["first log string", "second log string"]
| fields name = "first log string" as #first_string, name = "second log string" as #second_string
| stats sum(#first_string) as first_string, sum(#second_string) as second_string by bin(1hour)
Now I have a line chart with two lines representing the frequency of two logged items
I have a list of participants in column A. A full employee list in column B. I want to get the list of non-participants in column C. Basically 'B-A' but in list form.
'January' is the participants list:
try:
=FILTER(A:A; NOT(COUNTIF(B:B; A:A)))
It is always an added challenge to write formulas when we don't have access to actual date. But based on what I can see, try this formula in the top cell of any empty column:
=ArrayFormula({"My Header"; FILTER(R2:R,ISERROR(VLOOKUP(TRIM(R2:R),TRIM(T2:T),1,FALSE)))})
You can change "My Header" to something meaningful.
The next part means "FILTER in anything in the range R2:R that cannot be found [i.e., ISERROR(VLOOKUP(...))] in T2:T."
TRIM is used just to account for any accidental/stray spaces that may occur in either list, since that would result in no match if one or the other had extra space.
If this does not do what you expect, please share a link to a sample spreadsheet.
I am looking for a DAX function, or any trick with pbi desktop, to do the operation below :
2 tables :
'data' table, with a data column in text format
eg: "Product XXX.YYY"
'ref' table, with 2 columnes, key and label. The keys are usually some substrings of the data fieds.
eg. "Product XXX"; "Label 1"
I need to add to the data table a measure that contains the label matching the first key from the ref table that is a substring of the data
eg : "Product XXX" is a substring of "Product XXX.YYY" => should return "Label 1"
Of course, all values on the data column have a diferent format, so I can not manipulate the data to split "Product XXX" and "YYY" in a static way.
thanks a lot !
Alternative : rather than a dummy substring, if the key could be a full regex pattern to be matched, would be far more interesting ... :)
Without example data it's hard to test if this solution works, but since October 2018 there is a fuzzy matching preview feature.
Steps summary
Enable the fuzzy merge preview feature via File → Options → Preview Features
Go to Edit Queries and click on Merge Queries as New
Select the data table (containing the Product XXX.YYY values) as the source
Select the ref table as the match table
Pick a join type from the drop down
Tick the fuzzy matching checkbox
Try out some fuzzy matching options to see what is suitable
I'm trying to fuzzy match two columns in google sheets, i've tried numerous formulas but I think it's going to come down to a script to help out.
I have a column with product ID's e.g.
E20067
and then I have another sheet with another column which has image url's relating to this product code such as
http://wholesale.test.com/product/E20067/web_images/E20067.jpg
http://wholesale.test.com/product/E20067/high_res/E20067.jpg
http://wholesale.test.com/product/E20067/high_res/E20067-2.jpg
What I'm wanting to do is "fuzzy" match both of these columns for their product ID, and then create a new column for each match. So it would have the product ID then on the same row in multiple columns each product image URL - like the image below:
Is there a way to do this in google sheets using a script or a formula?
In Google sheets there are a few powerful 'regex' formulas.
Suppose, you have ID list in column A, and URL list in column B
Then use formula:
=REGEXEXTRACT(B1,JOIN("|",$A$1:$A$3))
It will match one of ID's. Drag the formula down to see the result as in picture above.
See more info here
Old thread but, in case you find yourself here, search for my Google Sheets add-on called Flookup. It should do exactly what you want.
For this case, you can use this function:
Flookup (lookupValue, tableArray, lookupCol, indexNum, threshold, [rank], [range])
The parameter details are:
lookupValue: the value you're looking up
tableArray: the table you want to search
lookupCol: the column you want to search
indexNum: the column you want data to be returned from
threshold: the percentage similarity below which data shouldn't be returned
rank: the nth best match (i.e. if the first one isn't to your liking)
range: choose to return the percentage similarity or row number for each match
You can find out more at the official website (examples and such).
Please note that, whereas the OP appears to want the whole list of possible matches, Flookup will only return one result at a time.
Flookup can now return a list of all possible matches through its LRM mode.
Try the following. I am assuming the product codes are in Sheet1 and the URLs are in Sheet2. Both in column A:
=iferror(transpose(FILTER(Sheet2!$A$2:$A,Search("*"& A2 &"*",Sheet2!$A$2:$A))))
Copy down.
If you want to show the image instead of the url try:
=arrayformula(image(iferror(transpose(FILTER(Sheet2!$A$2:$A,Search("*"& A2 &"*",Sheet2!$A$2:$A))))))
Is it possible to do a bulk insert with Sitecore Rocks? Something along the lines of SQL's
INSERT INTO TABLE1 SELECT COL1, COL2 FROM TABLE2
If so, what is the syntax? I'd like to add an item under any other item of a given template type.
I've tried using this syntax:
insert into (
##itemname,
##templateitem,
##path,
[etc.]
)
select
'Bulk-Add-Item',
//*[##id='{B2477E15-F54E-4DA1-B09D-825FF4D13F1D}'],
Path + '/Item',
[etc.]
To this, Query Analyzer responds:
"values" expected at position 440.
Please note that I have not found a working concatenation operator. For example,
Select ##item + '/value' from //sitecore/content/home/*
just returns '/value'. I've also tried ||, &&, and CONCATENATE without success.
There is apparently a way of doing bulk updates with CSV, but doing bulk updates directly from Sitecore Query Analyzer would be very useful
Currently you cannot do bulk inserts, but it is a really nice idea. I'll see what I can do.
Regarding the concatenation operator, this following works in the Query Analyzer:
select #Text + "/Value" from /sitecore/content/Home
This returns "Welcome to Sitecore/Value".
The ##item just returns empty, because it is not a valid system attribute.