Error in Kusto function-A recognition error occurred - function

I have a source table, which receives all the fields as a space-separated string. So I am using the update policy to parse it first, do some manipulation and ingest it to the target table. But however, I am getting this error and don't know why. I have been stuck for hours, any help would really be appreciated.
.create function
UpdateFunction()
{
TempTable
| parse Record with Timestamp:datetime' 'HouseNo:string' 'Age:int' "'Adress:string'" "'Name:string'" 'Gender:string' 'CountryCode:string
| extend FullName = split(Path,"?")
| join kind=leftouter countryTable on $left.CountryCode==$right.CountryCode
| project "Admitted", Timestamp,House,Age,Adress,Country,tostring(FullName[0]),tostring(FullName[1])
}
a sample record will look like this-
20-12-2021 20B 7 "XYZ House, New York" "Anna Thomas" Female US
and my target table data should be like this
Admitted,20-12-2021,20B,21, XYZ House New York, United States, Anna, Thomas
countryTable has the country mapping to the corresponding country codes.

For next time, please include a request ID in your message. You can copy it from the web explorer using this button:
Assuming I was able to locate your requests correctly, I believe you had an extra open quotes at the end of the parse operator line, with no corresponding closing quote. I see some successful requests after that. Please reply back with a request ID if you are still experiencing the same issues.

Related

Google Sheets: How to grab unique names and numbers from one sheet and adding it to another sheet based on a specific value

I just started working at a new company and I thought that I'd make a spreadsheet for my personal use. My boss came across me working on that spreadsheet and loved it so far. They've been manually entering values into their own spreadsheets since they've started and I thought it was super tedious, so I've been working on my own for the last week trying to improve efficiency on my end. Now my bosses want me to do this for the other branches... so the pressure is real for me. I've completed every other feature they've requested, but I'm struggling with this last one so I'm here now requesting help.
I have two sheets. One called "Inspection Results" and "Still Hasn't Passed Inspection."
"Inspection Results" looks something like this:
Timestamp
Date
Name
MS Number
Address
Jurisdiction
Inspection Result
4/21/2021
4/21/2021
John Smith
MS12345
123 Test St
Orange
Passed
4/20/2021
4/20/2021
John Smith
MS12345
123 Test St
Orange
Failed
4/21/2021
4/21/2021
Rick Grimes
MS12356
123 Meme St
Riverside
Passed
4/19/2021
4/19/2021
Michelle Obama
MS54321
123 Demo St
Long Beach
Failed
4/18/2021
4/18/2021
Michelle Obama
MS54321
123 Demo St
Long Beach
Failed
4/18/2021
4/18/2021
Courage Dog
MS98765
123 Coward St
Orange
Cancelled
"Still Hasn't Passed Inspection" currently looks like this:
Name
MS Number
I want to search every row in "Inspection Results" and find the Names(Column C) of the people that do not have a inspection result(Column G) of "Passed" and write a new row in "Still Hasn't Passed Inspection" with the Name(Column C) and MS Number(Column D) of those people that could not be found with a "Passed" inspection result.
I want the table in "Still Hasn't Passed Inspection" to have unique rows. For example, there are some rows in "Inspection Results" that I have the same Name and Inspection Result. In the table that I posted, Michelle Obama failed inspection. I only want Michelle Obama to appear one time in the "Still Hasn't Passed Inspection" sheet. John Smith failed inspection one day, but passed on the following day so he wouldn't be included in the table.
Basically, based on the example table I posted above, I want "Still Hasn't Passed Inspection" to look like this:
Name
MS Number
Michelle Obama
MS54321
Courage Dog
MS98765
I'm trying to automate this process so I, or whoever, doesn't have to keep manually entering and deleting rows every time someone finally passes inspection. If someone submits a "Passed" entry into "Inspection Results" for someone that previously "Failed" or "Cancelled", I want "Still Hasn't Passed Inspection" to be updated.
Is there a way I can accomplish this with certain formulas or am I going to have to create a script on this and, if so, does anyone have a reference they can point me towards? I'm not an experienced coder. I'm not familiar with Javascript and its syntax, but I do know how variables, if statements, and for loops work. I'm not asking anyone to write me a bunch of code on this. This isn't your responsibility. If you want to, of course, it would always be appreciated. Any hints or reference towards resolving this would be amazing.
Thank you.
I am a big fan of the query (QUERY(data, query, [headers])) function. Using it, you could do something like this on "Still Hasn't Passed Inspection"
=query(Inspection Results!A2:G, "Select C, D where G = 'Failed' OR G = 'Cancelled'")
This is saying to look at the data in the Inspection Results sheet, column A2 through G (specifying no row number will go to the end of the sheet).
It is then grabbing the contents of column C and column D in Inspection Results and pulling those into the sheet with the query function, in separate columns, a row for each result. It will only pull in the results where column G (Inspection Results in your example) is the string "Failed".
You would then need a query to get the ones that have passed, and filter the resultset based on that, such as:
=filter(query(A2:G, "Select C, D where G = 'Failed' OR G = 'Cancelled'"), arrayformula(not(countif(query(A2:G, "Select D where G = 'Passed'"), query(A2:G, "Select D where G = 'Failed' OR G = 'Cancelled'")))))
This is essentially saying, "Filter my query of not-passed inspections by looking at passed inspections, and not including any with the same MS Number"

How can I parse words when there is only Enter Mark between them in MySql?

I have an interesting data, Country names side by side, I need to get each one of them for spesific id.
I just don't know how can I parse those country names.
When I try to locate that mark,
select locate('ΒΆ',facility_country) from table_name,
it only returns me 0, doesn't work. I need to find a way to parse country names from that string.
for each id, I want to multiply my data on countries. Or maybe make a new dim table out of them: id and countries. In order to type my parse code or function, still not sure how to do it though but I can manage, I just need to locate that mark so I can separate.
I tried using Ascii, such like:
select CHAR(182);
This returns me the same mark.
select locate(CHAR(182),facility_country) from table_name;
When I try like that still I can't locate the mark, it only returns me 0.
How can I parse those county names with that Enter Mark? I have done similar things with "," or " " but first time I see something like that.
Edit: When I copy full text it looks like this after I paste:
USA
Australia
Brazil
Canada
France
Germany
Ireland
Israel
Italy
Netherlands
New Zealand
Switzerland
United Kingdom
(stackoverflow puts them side by side like that, on dbeaver this is what I see: )
edit2: #RiggsFolly requested this:
SELECT facility_country from clinical_trials LIMIT 5
output:
There are many lines like the line3.
edit3: #Tangentially Perpendicular solved it. We are looking at rendered image so we don't know what is the raw data, Apperantly its Char(10) and I can locate with it.

Sort numbers by string

Hi I am using an API from Postcode Anywhere, the idea being to add a company by searching by postcode to select the address, this is pretty standard and the code works fine.
Just some background info, PAW works in two stages, 1 the post code search criteria is sent off to their services, which returns an array of possible addresses, you then select the address you want, and in stage 2, the full PAF file for that ID is returned and stored to the table.
The problem I am having is that the array they send includes an Address Field which includes house number and street address in one field, making it difficult to sort alphanumerically.
This is the sample data I have in my table:
and this is how it looks in my application:
As you can see it is not ideal and I have no control on how they send the data.
Does anyone have any ideas on how I can search a string based on numbers that can be 1, 11, 2, instead of 01, 02, 03, etc, or at the very least be able to split this into two rows. Also please note, that it most cases, the post code search will result business/property names as well as house numbers, as seen in this example.
Any thoughts would be greatly appreciated.
Have you considered using a different API provider for the data, Allies Computing (who I work for) have a single step API, where the initial postcode search returns all fields in the response. It also orders these results by premise number/name.
Give it a try here - https://developers.alliescomputing.com/postcoder-web-api/address-lookup/premise
There are also other providers of PAF data that do it this way such as Crafty Clicks and Ideal Postcodes.
It might also be worth checking the PAF license with your provider to ensure you comply with that too.

How the google charts query language works?

I have implemented my own datasource in Go, which returns a JSON string. The data source is working fine and returning the correct JSON format expected by the chart (which is actually a table object to make the tests easier).
Now, I'd like to be able to use the query language features for my chart and something I could not figure out is how exactly the query language works.
Let's take the table below as example:
Name | Age | Phone
-------------------------------
John | 23 | 12341234
Chris | 47 | 54223452
Sam | 36 | 69694356
When called, my datasource will return a JSON representation of the entire table above.
In theory, I should be able to do something like this from my Javascript
query.setQuery('select Name, Age');
So, the result would ignore the column "Phone".
Now, my question is:
Is the setQuery() method applied to the JSON response only, or my datasource should be able to handle the query on request and return the correct data (only Name and Age columns). I'm not sure if the query language will act on the JSON response or if it's just an interface to tell the server what to do and the server should be able to prepare the correct data.
I'm asking that because as I said, my JSON response works fine, however the setQuery() method is being ignored. My table always shows the entire Dataset, no matter what I put on the setQuery method. Even if I define a column which does not exist, it does not cause any error.
I did some tests using a google spreadsheet and it works just fine. I should add that the structure of the JSON response from my app and the one from the google spreadsheet looks exactly the same.
Any help would be very much appreciated.
Thanks,
JB

Text search in database column

im using vb 2010 express edition. I have a database (Sql) and a table "students" in the database. It has a data like this:
StudentId Name Surname Classs
2266 Mike Brown 8
2773 Carol Smith 6
2883 Michel Old 7
2773 Miray Edem 6
27736 Cindy Temiz 7
......................................
......................................
there are lots of students. I want to put a search textbox on my form. User will search a student by name. When user presses a key on search textbox, for example "M" a box will appear and shows students which contains "M". (Mike, Michel, Miray) . It will work like google search. is there any way for me to help for this... Please share your ideas...
You should create a customautocomplete class for your textbox and set its autocomplete
Something like:
Dim tbox As New TextBox
Dim aCol As New AutoCompleteStringCollection
For Each student As String In dt.results("students")
aCol.Add()
Next
tbox.AutoCompleteSource = AutoCompleteSource.CustomSource
tbox.AutoCompleteCustomSource = aCol
tbox.AutoCompleteMode = AutoCompleteMode.SuggestAppend
I prefer VB.NET so I have provided an example in VB.NET as no language was specified.
I always use JQuery's autocomplete: http://docs.jquery.com/Plugins/autocomplete
Build your backend to do the search based on an input string and then have your ui do a json call with the autocomplete to return the results.
Is this a SQL query question or a software question, when you are asking for help? This sounds like a class assignment.
How are you going to be connecting to and querying your database? Are you going to write your query in a stored procedure in the database, or are you going to bind your software objects to the database tables?
Is it a convention at your location to use one kind of data access or query over another?