Forum Discussion
Hi @Tanmay_Sarkar,
You can also use Apache Velocity within JSON Generator. Here is the script:
#set($sum = 0)
#foreach ($field in $group)
#set($sum=$sum+$field.key2)
#end
#foreach($field in $group)
#set($dummy = $field.put(“sum”,$sum))
#end
{“group”:$group}
Regards,
Bojan
@bojanvelevski Thanks a lot, I never realized Apache Velocity can be used within JSON generator in such a way, this would come in handy in future.
Let me see if I understand:
You are reading from a csv file, then calling an API with a parameter that is a value from that file?
You then want to store data in a file --the same CSV or a different one?
And you getting an error -- what is the error?Can you include a sample pipeline or screenshots?
- virender_prajap3 years agoNew Contributor III
You can route your error to error view and save it in another csv file. If the returned error is a custom error and route the response in another downstream. Also in csv formatter, check option "ignore empty stream" to avoid creation of file if no documents exists in the upstream.
Related Content
- 4 months ago
- 10 months ago
- 3 years ago