I have created an FME workspace that return some validation messages in JSON. The output looks something like this:
{
"Response" : {
"transaction" : {
"id" : "78234626376472399",
"transactionDetail" : {
"validationResult" : d
{
"testCode" : "1001",
"testResult" : "PASSED",
},
{
"testCode" : "1002",
"testResult" : "FAILED",
"failMessage" : "fail Message 1"
},
{
"testCode" : "1003",
"testResult" : "PASSED",
},
{
"testCode" : "1004",
"testResult" : "FAILED",
"failMessage" : "fail Message 2"
},
{
"testCode" : "1005",
"testResult" : "PASSED",
},
{
"testCode" : "1006",
"testResult" : "FAILED",
"failMessage" : "fail Message 3"
}
{
"testCode" : "1007",
"testResult" : "PASSED",
}
]
}
}
}
}
Once I have generated this message, I need to add static string before the first failMessage and after last failMessage. This will be used by the application to display a message like:
You cannot proceed to next stage because: (This is static text)
- FailMessage 1
- FailMessage 2
- FailMessage 3
Please contact abc for detail. (This is static text)
How can I achieve this. I am using Sql Executor to pull data from DB and then JSON templater to create the JSON message. How to do I achieve appending these strings before the first fail message and after last fail messages? As you can see, the validationResult array may have both passed and failed results.
Please help.