Forum Discussion
Hi sainandam
I'm also using a datasink in almost the same way and so when I read your post - I thought "whats the problem?"
But after having another look at my script and the page (datasink page in soapui.org) - I can see the difference between my script and what yours is doing.
My script is successfully writing new records in my datasink file as rows rather than columns and that's what you are talking about - right?
I think I know why it's doing this - its because you have multiple records in your json response.
My script returns a json response with a single record (whereas your response returns multiple records) transfers the attributes to some properties, which are then sourced via the datasink to a flat file, and then I have a dataloop step going back to the rest request which generates my response and repeats - each time writing a new record in a new row in my datasink file.
I had a look in the soapui.org page I've referenced above just in case there was a certain option like 'append to file' but something more appropriate, but I don't think the OOB functionality on datasinks enables you to do what you want - i.e. write out multiple records in your json response into rows rather than columns in your datasink file.
I've only played around with the datasink functionality a little before now, so I could be mistaken - but I as I say above - I dont think the datasink functionality does what you want - so you have as far I can tell - 2 choices. Use groovy to handle this (which would probably be quite easy for a scripter - afraid I can't help you there!) or the other choice is to alter your REST request resultset via additional parms to restrict the number of records that are returned in your .json response.
I'm sorry I couldn't be of more help - but at least you now know why the datasink function is working this way!
Cheers,
richie
- sainandam7 years agoNew Contributor
Hi richie,
Thanks for the detailed writeup based on your understanding and experience with the tool.
I think i might need to look out for the solution in groovy as this seems to be a pottential bug in the tool. have seen your comment in the other thread about parametrisation and i know how tedious it will be when we dont know the count.
Thanks,
Sai
Related Content
- 10 years ago
Recent Discussions
- 18 days ago