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.
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.
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
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).
I use Get Metadata to retrieve files name in a blob container. I also have a README.md in this same blob container.
I would like to be able to apply filter and set variable value in function of the files present in the blob container, but without having consideration of the README.md file. How is it possible?
As an example, here is a logic I would like to implement for setting Variable value:
#if(and(equals(greater(activity('FilterOnOthers').output.FilteredItemsCount,0),true),not(equals(activity('FilterOnOthers').output.Value[0],'README.md'))),'YES','NO')
But it does not work as expected.
Thank you for your help
You can use an If Loop condition. In the If Loop condition check for the metadata output. The condition should be file name README.md. Use your desired activity inside the If Loop based on either TRUE/FALSE
Great question! Here's an almost fool-proof way to do so :
Create a variable of Array type in your pipeline, say 'x'.
Have the get metadata activity to read the folder and it's childItems by adding Child Items in the field list of the Dataset as shown below (highlighted) :
After getting the list of child items as an array in the output activity of the Get Metadata activity, chain a ForEach activity as shown in the above screenshot.
In the ForEach activity, for Items, use expression : #activity('Get Metadata1').output.childItems
In the activities tab of the forEach activity, create an ifCondition activity.
In the ifCondition activity, specify the condition. eg- #equals(item().name, 'README.md').
In the Activities tab of the ifCondition, add an "Append Variable" activity for false condition.
In the Append Variable, append value : #item().name to the variable 'x'.
Now your variable 'x' has all values except 'README.md'.
Hope I was clear in the explanation.
I´m splitting a large Workflow logic into different nested logic apps using the same Request Body JSON Schema, which represents a very large entity.
The problem I´m having is that in the designer, when i select a Logic app to be called, I have to specified every single property of the json schema one by one, which is also error prone as some of the properties have similar names.
Is there a way to send the complete body of the current logic app to the nested logic app?
I pass { "data": "#triggerBody()" } onto the child workflow for simplicity.
Yes it does add the need to insert 'data.' before each child workflow reference of a parent schema property but it's saved me a lot of typing!