Is there a way to load externaldata from a variable URL in Kusto? - kql

With Kusto's externaldata operator, I am able to load a text file from my website:
let appUsers = externaldata(userId:string)['https://www.mybusiness.com/files/salesforce-guid.txt'];
However I need to manipulate the URL string based on differing factors. When I try moving the URL into a variable, Kusto gives me syntax errors ( expected ']' )
let url = 'https://www.mybusiness.com/files/salesforce-guid.txt';
let appUsers = externaldata(userId:string)[url]; // syntax err
Is there a way for Kusto to load externaldata from a variable URL?

Such functionality doesn't exist.
You can suggest it on https://aka.ms/adx.uservoice

Related

Pentaho JsonInput GET fields

I'm trying to use PDI to read data from an API (json) and now I'm simply trying to use json input to get a few specific fields but the get fields button on the input step gives me.
ERROR (version 8.3.0.0-371, build 8.3.0.0-371 from 2019-06-11 11.09.08 by buildguy) : Index 1 out of bounds for length 1
all the steps execute fine, and produce data - just not the json input step doesn't wnat to give me the fields option! - I've tired the text file and json oput and both write valid json so IDK whats going on....
PS. this is my first time using PDI
ISSUE 2:
It looks like PDI uses jayway for its json path parsing so I've been using this site https://jsonpath.herokuapp.com/ jayway selection which gives me my expected path. When I put that into the 'fields' of the json input dialog I only get the FIRST instance of that path value vs it actually parsing the json and giving me every instance, and can't figure out why though I assume it has something to do with PDI's row based view on things but I also don't know how to get it to understand that its json and it should be giving me back all values that match that path.
UPDATE 1:
I've been looking at this https://forums.pentaho.com/threads/135882-Parsing-JSON-data-without-knowing-field-names/ it seems like this Modified Java Script Value step might be the way to go. Will continue testing.
UPDATE 2
OK - Used the MJSV as posted above along with a select fields step and finally able to get the key's
var obj = JSON.parse(mydata);
var keys = Object.keys(obj);
for (var i = 0; i < Object.keys(obj).length; i++) {
var row = createRowCopy(getOutputRowMeta().size());
var idx = getInputRowMeta().size();
row[idx++] = keys[i];
putRow(row);
}
trans_Status = SKIP_TRANSFORMATION;

Jmeter Parsing specific id in another request

I need to fetch id parameter from JSON and parse that id value in another request URL. Issue is in JSON i am getting multiple values of id like 6, Etc/UTC etc. I want only integer value to pass.
Please suggest solution for automate this instead of passing value everytime.
You can add regex expression to you JSON expression
$..book[?(#.author =~ /.*REES/i)] All books matching regex (ignore case)
In your case add regular expression for numbers:
=~ /.*(\d+)/i)]
My expectation is that you need to amend your JSON Path query to fetch not all IDs but only the ID(s) which is(are) numeric. Unfortunately without seeing your response and JSON Path query we cannot suggest anything meaningful.
Looking into your response I can only suggest only getting the first numeric ID using JSR223 PostProcessor and Groovy language.
Add JSR223 PostProcessor after the JSON Extractor
Put the following code into "Script" area:
for (int i = 1; i <= (vars.get('id_matchNr') as int); i++) {
def currentVar = vars.get('id_' + i)
if (currentVar =~ '(\\d+)') {
vars.put('someid', currentVar)
break;
}
}
You will be able to access the first numeric ID as ${someid} where required.

Lucene query : parse execption

I am using alfresco and trying to execute these queries,
These are my queries.
1st:
PATH:"/app:company_home/st:sites/cm:swsdp/cm:dataLists/cm:aea88103-517e-4aa0-a3be-de258d0e6465//*"
1st query is working properly but 2nd query is not able to parse
2nd
+PATH:"/app:company_home/st:swsdp/cm:/cm:dataLists/cm:9787a75b-cbc9-4d42-b76c-df88461e62c6//*"
Exception :
Cannot parse '+PATH:"/app:company_home/st:swsdp/cm:/cm:dataLists/cm:9787a75b-cbc9-4d42-b76c-df88461e62c6//*" AND +TYPE:"fdm:formDatalist"': Failed to parse XPath...
Unexpected '9787'
I tried by escaping but still getting same.
+PATH:"/app:company_home/st:swsdp/cm:/cm:dataLists/cm:9787a75b\-cbc9\-4d42-b76c\-df88461e62c6//
I noticed that in 1st query cm:aea88103-517e-4aa0-a3be-de258d0e6465 starts with latter but in 2nd query cm:9787a75b-cbc9-4d42-b76c-df88461e62c6 this contains numbers in starting so that it's not able to parse.
Please solve this error.
Certain characters need to be encoded in hexa for lucene PATH queries.
You need to encode your path this way :
var rawString = "//test:123 DIR/FILE.TXT #";
=> rawString: //test:123 DIR/FILE.TXT #
var encodedString = search.ISO9075Encode(rawString);
=> encodedString: _x002f__x002f_test_x003a_123_x0020_DIR_x002f_FILE.TXT_x0020__x0040_
var decodedString = search.ISO9075Decode(encodedString);
=> decodedString: //test:123 DIR/FILE.TXT #
See alfresco documentation for more information : http://docs.alfresco.com/5.2/references/API-JS-iso9075Encode.html

Play reverse routing - getting absolute url

How can I get the absolute URL in play 2.2 scala when doing the following:
val promoLink = routes.Promotions.promotionsCategory(DOCID, slug)
//routes file
GET /promotions/:DOCID:/slug controllers.Promotions.promoCat(DOCID, slug)
As it stands I get a "found : play.api.mvc.Call" type mismatch on expecting a string
thanks
I suppose your promoLink should be a String containing an URL? Your question sounds a bit unclear.
If so then you probably need this:
val promoLink = routes.Promotions.promotionsCategory(DOCID, slug).absoluteURL(false)(request)
false in the .absoluteURL(false) stands for the isSecure parameter which will give you http or https url.
If you have an implicit request in scope you may omit the last (request) part

Specifying a search query in the dropbox API

I have successfully set up a dropbox API (using Spring.Social.DropBox) and am trying to programmatically search my dropbox folder. How do I specifiy a query that can return more than one file type?
DropboxServiceProvider ^dropboxServiceProvider = gcnew Spring::Social::Dropbox::Connect::DropboxServiceProvider(appKey, appSecret, Spring::Social::Dropbox::Api::AccessLevel::AppFolder);
IDropbox ^dropboxApi = dropboxServiceProvider->GetApi(myAccessToken, myAccessSecret);
System::String ^pth = "TestFolder";
System::String ^qry = ".txt";
System::Collections::Generic::IList<Spring::Social::Dropbox::Api::Entry^> ^results = dropboxApi->Search(pth, qry);
The above code works when the querty specifies just one file type (.txt, .png). But how do I construct a query to retrieve multiple file types? I have tried
System::String ^qry = ".txt;.png";
System::String ^qry = ".{txt|png}";
System::String ^qry = ".txt?.png";
Any idea how to do this?
The Dropbox API does not currently support regex queries or any sort of boolean operators like this, so this isn't currently possible. You can get all files of any type with a given name, or all files of a given type by searching for the respective name or type alone, but you can't search for multiple values on a single call. (One workaround may be to make the relevant calls and combine the results together.)