How to get the certain value from column description Postgres - psql

I have a column stating "Description", that holds log details of a process.
Log contains many entries, I would like to only get only line that states "Error Value" and followed by 5-6 words from the entry(that describes error)
Do I have to use SUBSTRING? OR Is this possible? Pleas suggest

select * from table where description like '%Error Value%'
This will be expensive query. If you would know the very start of value, you could remove starting % which would make it much faster if you have index on that column...

Related

How do I return missing data when comparing two columns?

I've read a few similar questions, and I can't seem to find exactly what I'm trying to do.
I have a roster of employees in sheet "Roster" with their names in Column A. In sheet "Hours" I have a list of assigned jobs for tomorrow, with the assigned employee's name also in Column A. I'm trying to add a column of employees from the roster that are NOT in the list of employees on jobs.
The closest I've gotten is with this, on the Hours sheet:
=ARRAYFORMULA(VLOOKUP('Roster'!A2:A, A2:A,1,0))
which gives me a list of the entire roster, with the missing ones returning an #N/A error that tells me the missing name when I mouse over it and read the error code. Is there a way to just get a list of the errors? Would I be better off attacking this from a completely different angle?
EDIT: Sanitized example pictures. If what I was trying to do worked, it would return Bob and Jim in this example.
Assuming you're trying to return this list in the "Hours" sheet, you can build off what you had. Try this:
=ARRAYFORMULA(FILTER(A2:A,ISERROR(VLOOKUP('Roster'!A2:A, A2:A,1,0))))
Keep in mind that this formula was written sight-unseen. If it doesn't work as expected, consider sharing a link to a copy of your sheet (or to a sample sheet set up the same way and with enough sanitized but realistic data to illustrate the problem, along with the manually entered result you want in the range where you want it).
I ended up going a completely different route. I made a third "Under the Hood" sheet, pulled the two columns into it with queries, ran a match formula down the list and returned "" on errors, then ran a query on Hours to get the names where it had null for the match list.

Index / Match - Receiving an error when trying to find entry

I am very fresh with Excel and still learning the basics. I came upon an issue I really need help with and couldn't find suitable solution online.
I have a column I keep on constantly updating with Bulk data THE COLUMN.
I'd like to see the most common entry and the least common entry for a specific time using this formula:
=INDEX('Data Input'!F433:F610,MODE(MATCH('Data Input'!F433:F610,'Data Input'!F433:F610,0)))
But once I try it, it constantly tells me:
Did not find value '' in MATCH evaluation.
I've tried with shorter ranges and It did work, so I guess once it runs through empty cell - it breaks. How can I modify this formula to function properly and print what I need?
And side question, is is possible to implement a calendar bar and choose between dates?
You can insert a clause to exclude blanks (assuming they are not to be considered a legitimate return):
=INDEX('Data Input'!F433:F610,MODE(IF('Data Input'!F433:F610<>"",MATCH('Data Input'!F433:F610,'Data Input'!F433:F610,{0,0}))))
Note that I have used
{0,0}
for MATCH's match_type parameter so that the formula will not error should there be more than one entry within your range which shares the highest frequency. In such cases, the above formula will return that which occurs first in your list.

Google Spreadsheet LOOKUP by Dynamic Value

I am trying to figure out if it is possible to use LOOKUP function that is based on a dyanmic value. For example:
=LOOKUP("A", C$2:C$1000, B$2:B$1000)
The above will look for Letter A in C Column and then write the value from the corresponding B Column row. What I wish to do is now read the Letter A from the D column, like so:
=LOOKUP(D2, Sheet2!C$2:C$1000, Sheet2!B$2:B$1000)
However, the above gives me an error. Is there a way to accomplish the above?
The above keeps returning me with an error saying value not found, I'm not sure what I am doing wrong.
EDIT
Ok so I have been playing more with this and I started having some very strange results. Lets take the following table: https://docs.google.com/spreadsheets/d/1ki3pmCOQoI1DLcbjEO-uwgwZGFfnHhM-fodspw8v1Qs/#gid=1001637055
Then my second sheet is this:
https://docs.google.com/spreadsheets/d/1ki3pmCOQoI1DLcbjEO-uwgwZGFfnHhM-fodspw8v1Qs/edit#gid=1993578337
If you look at the second sheet, bob shows up multiple times and I don't understand why.
Reason for #N/A's
lookup produces #N/A if it is looking up an empty range as is the case here. `'Draft Options'!A:A is empty so lookup cannot find a value to look up against.
Reason for multiple appearances
The documentation states that:
The LOOKUP function will only work properly if data in search_range or
search_result_array is sorted. Use VLOOKUP, HLOOKUP, or other related
functions if data is not sorted.
If search_key is not found, the item used in the lookup will be the
value that’s immediately smaller in the range provided. For example,
if the data set contains the numbers 1, 3, 5 and search_key is 2, then
1 will be used for the lookup.
Now, you are looking up Text but the same thing applies, it needs to be ordered alphabetically.
This is because lookup is doing something called binary search
Since your data is unordered and (assuming you have column A filled with keys the following can happen which leads to weird results:
Lookup looks at the middle entry and checks if the value comes before or
after the lookup value in an alphabetically sorted list.
If it comes
before it checks the the entry int he middle between the beginning
of the list and the middle.
If your entry happens to be in the latter half lookup never finds this entry
or
This value might not exists so it picks the first value it can find that would come before that (assuming the data is sorted) or something (seemingly random) where lookup finds value n to be alphabetically after the lookup value and n+1 alphabetically before and returns value n+1.
You should only use lookup if you know the lookup values will be there and that they will be sorted. Otherwise you might want to take a look at VLookup or Index Match
Solution
If Column A in Sheet Draft options Actually contains those letters you are looking up you can use a simple VLookup:
=VLOOKUP(F2, `Draft Options`!$A$2:$B$1000, 2, FALSE)
Here FALSE specifies that VLookup shall not use a binary search algorithm and instead go through the list linearly (i.e. one by one) which is slower but will retrieve the first matching value or throw an error if it is not there instead of returning something odd.

division not working with continuous query in influxdb

I am trying to generate a continuous query in influxDB. The query is to fetch the hits per second by doing (1/response time) of the value which i am already getting for another series (say series1).
Here is the query:
select (1000/value) as value from series1 group by time(1s) into api.HPS;
My problem is that the query "select (1000/value) as value from series1 group by time(1s)" works fine and provide me results but as soon as I store the result into continuous query, it starts to give me parse error.
Please help.
Hard to give any concrete advice without the actual parse error returned and perhaps the relevant log lines. Try providing those to the mailing list at influxdb#googlegroups.com or email them to support#influxdb.com.
There's an email on the Google Group that might be relevant, too. https://groups.google.com/d/msgid/influxdb/c99217b3-fdab-4684-b656-a5f5509ed070%40googlegroups.com
Have you tried using whitespace between the values and the operator? E.g. select (1000 / value) AS value....

Append Query That Also Selects A Lookup Table Value Based On Text Parsing?

I've posted a demo Access db at http://www.derekbeck.com/Database0.accdb . I'm using Access 2007.
I am importing an excel spreadsheet, which my organization gets weekly, importing it into Access. It gets imported the table [imported Task list]. From there, an append query reformats it and appends it to my [Master Task List] table.
Previously, we have had a form, where we would manually go through the newest imports, and manually select whether our department was the primary POC for a tasking. I want to automate this.
What syntax do I require, such that the append query will parse the text from [imported Task list].[Department], searching for those divisions listed on [OurDepartments] table (those parts of our company for which we are tracking these tasks), and then select the appropriate Lookup field (connected to [OurDepartments] table) in our [Master Task List] table?
I know that's a mouth full... Put another way, I want the append query update the [Master Task List].[OurDepartments], which is a lookup, based on parsing the text of [imported Task list].[Department].
Note the tricky element: we have to parse the text for "BA" as well as "BAD", "BAC", etc. The shorter "BA" might be an interesting issue for this query.
Hoping for a Non-VBA solution.
Thanks for taking a look!
Derek
PS: Would be very helpful if anyone might be able to respond within the work week. Thx!
The answer is here: http://www.utteraccess.com/forum/Append-Query-Selects-L-t1984607.html

Resources