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).
Related
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']
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.
How do we write gremlin update/modify query in node.js ?
I want to update particular field and save the same and do not modify other fields which are not edited.
I have a table called "org" and it has some properties like name, id, label.
How can we modify particular property or all the properties depends on the put body request ? using gremlin query
Any property can be updated as follows (assuming it is a single value and not a set)
g.V('some-id').
property(Cardinality.single,'my-property',new-value).
iterate()
UPDATED: If you need to update the contents of multiple properties you can just chain the property steps together.
g.V('some-id').
property(Cardinality.single,'p1',new-value).
property(Cardinality.single,'p2',new-value).
property(Cardinality.single,'p3',new-value).
property(Cardinality.single,'p4',new-value).iterate()
UPDATED again
If you only want to set a property value if the property already exists you can check for its existence using a 'has' step as shown below.
g.V('some-id').
has('p1').
property(Cardinality.single,'p1',new-value)
If you want to do this for more than one property you can use optional steps as one way to do multiple of these checks.
g.V('some-id').
optional(has('p1').
property(Cardinality.single,'p1',new-value)).
optional(has('p2').
property(Cardinality.single,'p2',new-value)).
Some additional information can be found at [1] and [2]
[1] http://www.kelvinlawrence.net/book/PracticalGremlin.html#addnodes
[2] https://tinkerpop.apache.org/docs/current/reference/#addproperty-step
Would really appreciate some assistance / pointers with what has to be a very common and probably simple situation, but just does not seem to be obvious to me.
Consider the situation below:
All I am doing is reading some data in from a blob - works fine.
Then, using a json parse to get the dynamic tags/labels to work with.
Then I am appending the 'name' values into a variable of name: 'myArr' of type array which I initialised a step or two earlier.
When I run I can inspect the contents of 'myArr' and all the names are in there. So far so good.
Now.. how can I write the contents of 'myArr' into a blob or out to a data lake? When I add a create blob activity there is no way to select the 'myArr' variable as the content. I am messing around with another foreach control activity, but it just gets messy and doesn't work.
There has to be a simple/elegant way to push that array variable into a blob?
Thanks!
The "Blob content" input box requires a file content but not a array variable, so you need to do some operation on "myArr". You can use "Parse JSON" action to parse the "myArr" and then you can select the "Body" from "Parse JSON" action into the "Blob content" input box, shown as below screenshot:
Hope it helps~
I am receiving a fairly flat set of data that has homePhone, cellPhone and workPhone on it. The destination expects the data to be normalized so that it gets:
{
...
"phones": [
{"type":"work", "number":"888-888-888"},
{"type":"cell", "number":"888-888-888"},
{"type":"home", "number":"888-888-888"},
]
...
}
If one of the fields is null or blank then that element should not be sent. How can I configure the body of an HTTP post action to optionally add an object to the array only if the incoming property has a value?
You could try to add a condition statement to control workflow action like the sample in the screenshot.
For more details, refer to this article.
I was able to find an answer, it's the Compose action with the Append to array variable action. It allows the composition of objects and then the Append to array allows the build up of the objects in an array.