Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to merge two strings from a Json loop into one. I have the following components in play at present.
tFileInputJson-->tMap-->tFileOutputDelimited.
My input json document looks like
{
"columns": {
"source": "config",
"column_details": [{
"columnname": "col2",
"datatype": "float"
},
{
"columnname": "col3",
"datatype": "integer"
}
]
}
}
I would like to create a string in tFileOutputDelimited as
"The result set is
convert col2 to float
convert col3 to integer"
However due to the loop XPath query parameter being set to "/columns/column_details" in tFileInputJson and creating the string in tMap with columnname and datatype. I get the following output
The result set is
convert col2 to float
The result set is
convert col3 to integer
Any help is appreciated. Thanks
Look at the tJavaFlex component, you have to code some java but pretty easy.
Something like below (didnt test the java code).
Basicly in the Pre part you set:
String fullString = "The result set is ";
In the Main part (this will loop over all the rows) , you set :
fullString = fullString + "convert " + row.columnname + " to " + row.datatype + "\n"
Look at the tJavaFlex component, you have to code some java but pretty easy.
Something like below (didnt test the java code).
Basicly in the Pre part you set:
String fullString = "The result set is ";
In the Main part (this will loop over all the rows) , you set :
fullString = fullString + "convert " + row.columnname + " to " + row.datatype + "\n"