I'm using ADF Web activity to submit a GET request to the external API.
From the web activity (2) I'm getting the following output:
Now, I want to assign a variable with value of the element that is marked on the screen.
Unfortunately, the following expressioin is invalid:
#activity('Web1').output.ADFWebActivityResponseHeaders.Total-Count
Is looks to me that ADF is not able to parse this expression due to special character ("-") in the name of property I'm trying to extract.
When I use a different expression to access a different parameter:
#activity('Web1').output.ADFWebActivityResponseHeaders.Status
it works.
Do you have any idea how I should write the expression to extract the value of "Total-Count" ?
According to this post ADF retrieves value from field with dash from json file this could work for you, too.
The expression in your case could look like this:
#activity('Web1').output.ADFWebActivityResponseHeaders['total-count']
Related
I have a Copy Data task which is obtaining data from an API
The API is a GET call to a method and requires 2 parameters
_token
Symbols
I have defined these as parameters
What is the syntax that allows me to use the values of my parameters as the values that are in the query string? So in the screenshot above Symbols is hard coded, but I want the value to be the value of the parameters
I need a screen solution rather than code please as I am not comfortable with ADF yet and I dont know how to get to the code/ARM views
Paul
Using a feature called string interpolation where expressions are wrapped in #{ ... }
Click on the Base URL field. Add Parameters. Using Concat expression function,
Example:
#{Concat('https://stackoverflow.com/questions/GetRealTimeRates?',linkedService().Symbols,'=',linkedService()._token)}
Add first parameter:
Add second parameter:
Test connection. If you see any error, it would provide a description as to debug further.
I've been trying to set the value of a parameter, based on the value I set of another parameter. This wasn't working but then I discovered the Parameters with Functions JSON example on the Azure GitHub
This is giving the same behaviour as my own template so is perfect to show the issues I am having.
As you can see from the JSON linked to above, the parameter hostingPlanName should concat the parameter siteName with the string -plan. When I edit the parameter file, I see the function instead of the value it resolves to.
This example pulls other values in to set the value of siteName, I wondered if that was the reasons so hard set siteName to 'TEST' and the result for hostingPlanName was the same.
I haven't deployed this example, but if I deploy my real template, it throws an error with Bad Request for the name of the resource I am deploying.
Is this me or is this not possible anymore?
I am using VS2019 Community.
This is a great place to use variables. Your hostingPlanName is not set directly by user input (as parameters should be), but is a dynamic evaluation of a complex value based on a parameter, so it should be a variable.
My JSON array is as follows.
[{"20656":"20656","20648":"20648","20666":"20666","20657":"20657","20658":"20658","20659":"20659","20660":"20660","20665":"20665","20672":"20672","20667":"20667","24517":"24517","20677":"20677","20662":"20662","24605":"24605","20675":"20675","20663":"20663","20649":"20649","20664":"20664","20668":"20668","20669":"20669","20670":"20670","20671":"20671","20673":"20673","20674":"20674","20676":"20676"}]
How do I use each individual value and use it as a variable for my next query.
Thanks,
Assuming your variable looks like this
Add Select Action
Which has From property set to
split(replace(replace(replace(variables('MyJsonArray'),'[{',''),'}]',''),'"',''),',')
And Map to pair MyID with expression
substring(item(),0,lastIndexOf(item(),':'))
Now you can simply iternate over all IDs with simple Foreach and refer to each ID by using expression
item()['MyID']
You can use "Parse JSON" action to parse your json data.
First, I create a "Initialize variable" action to store the json data(shown as below screenshot)
Then create "Parse JSON" action to parse the json object above.
If you don't know how to create the schema, you can click "Use sample payload to generate schema" and input your json data into it. It will generate the schema for you automatically. You can also refer to this tutorial: https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-perform-data-operations#parse-json-action
After that, we can use each individual value as variable in our logic app.(I created "Initialize variable 2" in the screenshot below as an example).
So...I managed to create a URL which populates a parameterised information link.
https://myserver-prod.mycompany.net/SpotfireWeb/ViewAnalysis.aspx?file=/Reports/02_Testing/Hyperlink_Parameter_Test&configurationBlock=pCountry%3D%22GERMANY%22%3B
This passes in GERMANY to the pCountry parameter and is working fine.
However, I am not sure how I would push in an array of values. I have changed my parameter to be an array, and am trying different things but they are not working.
This documentation isn't great in this respect.
https://community.tibco.com/wiki/create-configuration-block-tibco-spotfire
I have tried things like this, where I am comma separating the parameters (here I am passing in GERMANY and FRANCE separated by a url encoded comma (%3B).
https://spotfireweb-prod.rd.astrazeneca.net/SpotfireWeb/ViewAnalysis.aspx?file=/GMD/GRAPSQA/ARIEL/Reports/02_Testing/Hyperlink_Parameter_Test_Array&configurationBlock=pCountry%3D%22GERMANY%3BFRANCE%22%3B
A list parameter has the following syntax:
COUNTRY={"GERMANY","FRANCE"};
Used in a URL it must be encoded: COUNTRY%3D%7B%22GERMANY%22%2C%22FRANCE%22%7D
Learn more about configuration blocks here: https://community.tibco.com/wiki/create-configuration-block-tibco-spotfire
I try to get an extract of the text with the searched words highlighted on a JSON collection.
My search syntax is:
qb.word(qb.field('doc_text'),vartxt)
With 'doc_text' declared as field
(field type: root, include root: false, includes: doc_text), in an Node.js application.
The search works well, and it is done well on this field ...
But in txt[0].results[kl].matches[0]['match-text'], I find the first 3 properties of the JSON,
and not an extract from 'doc_text' with the words found.
I have another application in which the highlights work correctly, but it is based on XML.
Did I forget something in the field declaration, or is the operation different between JSON
and XML data, or is the highlight system not running on JSON via Node.js and QueryBuilder ?
Kind regards
Fields do not work quite the same way in XML and JSON. I think you're running into this limitation:
http://docs.marklogic.com/guide/app-dev/json#id_24090
The value of a field in XML can be the concatenation of all the text nodes, but the same does not apply in JSON.
I think I understood !!!
This query gives a correct snippet, with the extract and the words highlighted :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'))
On the other hand, this query gives the first 3 fields of the JSON :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'), mkcq.value(mkcq.element('','doc_user'), 'mbp'))
I do not know if this is normal or not, but it should be able to be corrected either by a simplified query and a selection on the returned records, evening by a particular snippeter.
Kind regards