If i use just 1 file it works perfectly, but with more than 1 it fails
This is my request
{
"Arguments":{
"InputArguments":[
{
"Resource":"https://s3url.com",
"Name":"HostDwg1-050A-014"
},
{
"Resource":"https://s3url.com",
"Name":"HostDwg1-050A-015"
}
],
"OutputArguments":[
{
"Name":"Result1-050A-014",
"HttpVerb":"PUT",
"Resource":"https:://s3url.com",
"StorageProvider":"Generic"
},
{
"Name":"Result1-050A-015",
"HttpVerb":"PUT",
"Resource":"https://s3url.com",
"StorageProvider":"Generic"
}
]
},
"ActivityId":"PlotToPDF",
"Id":""
}
This is the error i get
The number of Arguments is bigger than the number of Parameters.
Parameter name: Count
How have to be done the request to convert more than one file, without doing a request for each file? thanks
The PlotToPDF activity declares exactly one input parameter and exactly one output parameter. An activity is like a function in a programming language: you can only provide as many arguments as there are parameters. So...
If you want to have a workitem that has more than one input/output argument then you should define an new custom activity that has more than one input/output parameters.
If you want plot multiple files then you should simply submit multiple workitems.
Related
I'm working on power automate and I have an issue because I've tried a lot expressions and none of them working.
I did a loop (foreach) and inside a message (compose) and there I tried to display "f7626790-0756-43bf-a757-a645a33b853d" from"client"
To do so, I've tried all those expressions:
item()?['client']
item()?['client']?[0]
item()['client']
Here my json file:
[
{
"gift": [
{
"client": "f7626790-0756-43bf-a757-a645a33b853d",
"details": [
{
"client_id": 10859085,
"type": "christmas",
"application_id": "6e6d758d-8e74-3ae3-ac84-50eb23ae65f"
}
]
}
]
}
]
Thank's in advance.
Based on the JSON you provided, you have two arrays. So the question for me is, which array do you want to iterate? Both or the inner one?
I'm going to assume both or if not, it won't matter if you only ever have one item for both of them, my answer will still retrieve the client property.
The Initialize Data step has your JSON.
The Initialize Client step is a blank string at this stage.
The For Each Outer Item expression is simply a link to the Data variable as initialized in the first step.
The For Each Gift expression is set as ... item()?['gift'] ... as you can work out, that will loop over each gift item.
Finally, I get the value of the client property using this expression ... item()['client']
Trying to figuring out how to deserialize this kind of json in talend components :
{
"ryan#toofr.com": {
"confidence":119,"email":"ryan#toofr.com","default":20
},
"rbuckley#toofr.com": {
"confidence":20,"email":"rbuckley#toofr.com","default":15
},
"ryan.buckley#toofr.com": {
"confidence":18,"email":"ryan.buckley#toofr.com","default":16
},
"ryanbuckley#toofr.com": {
"confidence":17,"email":"ryanbuckley#toofr.com","default":17
},
"ryan_buckley#toofr.com": {
"confidence":16,"email":"ryan_buckley#toofr.com","default":18
},
"ryan-buckley#toofr.com": {
"confidence":15,"email":"ryan-buckley#toofr.com","default":19
},
"ryanb#toofr.com": {
"confidence":14,"email":"ryanb#toofr.com","default":14
},
"buckley#toofr.com": {
"confidence":13,"email":"buckley#toofr.com","default":13
}
}
This JSON comes from the Toofr API where documentation can be found here .
Here the actual sitation :
For each line retreived in the database, I call the API and I got this (the first name, the last name and the company change everytime.
Does anyone know how to modify the tExtractJSONField (or use smthing else) to show the results in tLogRow (for each line in the database) ?
Thank you in advance !
EDIT 1:
Here's my tExtractJSONfields :
When using tExtractJSONFields with XPath, you need
1) a valid XPath loop point
2) valid XPath mapping to your structure relative to the loop path
Also, when using XPath with Talend, every value needs a key. The key cannot change if you want to loop over it. Meaning this is invalid:
{
"ryan#toofr.com": {
"confidence":119,"email":"ryan#toofr.com","default":20
},
"rbuckley#toofr.com": {
"confidence":20,"email":"rbuckley#toofr.com","default":15
},
but this structure would be valid:
{
"contact": {
"confidence":119,"email":"ryan#toofr.com","default":20
},
"contact": {
"confidence":20,"email":"rbuckley#toofr.com","default":15
},
So with the correct data the loop point might be /contact.
Then the mapping for Confidence would be confidence (the name from the JSON), the mapping for Email would be email and vice versa for default.
EDIT
JSONPath has a few disadvantages, one of them being you cannot go higher up in the hierarchy. You can try finding out the correct query with jsonpath.com
The loop expression could be $.*. I am not sure if that will satisfy your need, though - it has been a while since I've been using JSONPath in Talend because of the downsides.
I have been ingesting some complex json structures and did this via minimal json libraries, and tjava components within talend.
I am trying to create a view to group on a particular attribute inside an array. However, the below map function is not returning any result.
JSON Document Structure :
{
"jsontype": "survey_response",
"jsoninstance": "xyz",
"jsonlanguage": "en_us",
"jsonuser": "test#test.com",
"jsoncontact": "test#mayoclinic.com",
"pages": [
{
q-placeholder": "q1-p1",
q:localized": "q1-localized-p1",
q-answer-placeholder": "jawaabu121",
q-answer-localized": "localized jawaabu1"
},
{
q-placeholder": "q2-p2",
q:localized": "q2-localized-p2",
q-answer-placeholder": "jawaabu221",
q-answer-localized": "localized jawaabu2"
},
{
"q-placeholder": "q3-p3",
"q:localized": "q3-localized-p3",
"q-answer-placeholder": "jawaabu313",
"q-answer-localized": "localized jawaabu3"
}
]
}
Map Function :
function(doc, meta){
emit(doc.jsoninstance,[doc.pages[0].q-placeholder, doc.pages[0].q-localized,doc.pages[0].q-answer-placeholder,q-answer-localized]);
}
It looks like you made a typo at the end of your emit statement:
doc.pages[0].q-answer-placeholder,q-answer-localized.
Instead q-answer-localized should be changed to doc.pages[0].q-answer-localized.
Further to this it seems that you have defined a field as q-localized in your emit statement, but actually according to the sample document that you posted this should actually be q:localized, I assume that this was a mistake in the snippet of the document and not the emit statement, but if not then will also need amending.
I would imagine errors like this would be flagged up in the view engine's map-reduce error log, in future you should check this log so that you will be able to debug errors like this yourself.
The location of the mapreduce_errors log can be found in the Couchbase documentation
JSON body for an HTTP request needs to look like:
{
"OrderId":"234",
"SupplierId":"JJ889",
"OrderedProducts": [
{
"ProductId":"123",
"Sku":"ABC123",
"Description":"Thing 1"
},
{
"ProductId":"435",
"Sku":"XYZ987",
"Description":"Thing 2"
}
]
}
And I have a CSV file that looks like:
ProductId,Sku,Description
123,ABC123,Thing 1
435,XYZ987,Thing 2
....
But when I substitute "ProductId":"${ProductId}" (and the other variables for sku and description) in the HTTP Request body data I end up with:
{
"OrderId":"234",
"SupplierId":"JJ889",
"OrderedProducts": [
{
"ProductId":"123",
"Sku":"ABC123",
"Description":"Thing 1"
},
{
"ProductId":"123",
"Sku":"ABC123",
"Description":"Thing 1"
}
]
}
How do I ensure my collection of products is unique (i.e. different CSV line) per request?
If you have always 2 products per request, just organize your CSV this way:
ProductId1,Sku1,Description1,ProductId2,Sku2,Description2
And use the new variable names.
Use combination of __StringFromFile() and __javaScript() functions like:
{
"OrderId":"234",
"SupplierId":"JJ889",
"OrderedProducts": [
{
"ProductId":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[0],)}",
"Sku":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[1],)}",
"Description":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[2],)}"
},
{
"ProductId":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[0],)}",
"Sku":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[1],)}",
"Description":"${__javaScript("${__StringFromFile(file.csv,,,)}".split("\,")[2],)}"
}
]
}
__StringFromFile() function reads next line from file.csv each time it's being called
__javaScript() function allows executing arbitrary JavaScript code, in above case split() function to break the line into ProductId, Sku and Description.
See Functions and Variables User Manual chapter and How to Use JMeter Functions posts series for more information on JMeter functions.
I am trying to build a bar chart which will allow the user to switch among different datasets (tot1 and tot2) all included in one JSON file:
{
"users":
{
"gender":
{
"tot1":
[
{"label":"female", "value":6038},
{"label":"male", "value":45228},
{"label":"unknown", "value":32932}
]
"tot2":
[
{"label":"female", "value":6022},
{"label":"male", "value":45328},
{"label":"unknown", "value":12932}
]
}
}
}
I don't see how I should proceed. Following the solution to a previous question I would need to select tot1 or tot2 when loading the data with d3.json. Of course the chart specs don't change when switching from tot1 to tot2, so probably the right approach would be to compose the chart with a function which receives the data as an argument...
But if I try to load my data into variables I get an error
data1 = d3.json("../data.json", function(data) {return data.users.gender.tot;});