How to fetch multiple values from request and update to DB
Hi All,
We have a request with multiple sections which has different id's and username as below shown in the sample request.
Currently we are using JSON data bank to extract the values from id and username and in the next step using DB tool updating these values in to the DB table.
However, it is only fetching the first records from the request and updating in to the DB, could you please help how can we fetch all the records from request and update each records in to DB accordingly.
{
"records": [
{
"id": "rec25eKmUsfiieG2B",
"createdTime": "2021-05-21T20:17:43.000Z",
"username": "Jonny W"
},
{
"id": "rec2dLF92AG8JTL0S",
"createdTime": "2021-03-20T18:02:38.000Z",
"username": "Debbie"
},
{
"id": "rec5w5lUPzN8Yd3um",
"createdTime": "2021-03-20T20:41:51.000Z",
"username": "Louie"
}
]
}
Answers
-
Hi,
You might need to look into this extension that can help split a message into each record and then uses a responder to process each record.
https://docs.parasoft.com/display/SOAVIRT20241/Multiple+Response+Generator+1.1
0 -
Thank you so much William for your input, I tried to implement using Multiple response generator but it couldn't get the results as expected.
In our scenario, we don't need to send any multiple response for each request in the list.
From the below incoming request I need to fetch intervalDetails such as intervalDate, intervalStartTime,
intervalEndTime and newValue and UPDATE those values in to the database table columns accordingly.{
"digitalTwinRequest" : {
"updateIntervalUsage" : {
"env" : "qa",
"meterNumber" : "DTM00003",
"intervalDetails" : [
{
"intervalDate" : "2024-06-02",
"intervalStartTime" : "10:00:00",
"intervalEndTime" : "11:00:00",
"newValue" : "10"
},
{
"intervalDate" : "2024-06-02",
"intervalStartTime" : "00:15:00",
"intervalEndTime" : "02:30:00",
"newValue" : "0.25"
}
]
}
}
}0 -
Hi,
The way the multiple response generator works is that it splits those "intervalDetails" items into just the single array item and forwards that to another responder. That second responder would then use data banks and tools on just the single array item to perform the actions needed. It could then return a result to the original responder for each item, or not. The client isn't sent multiple response.
0