Need Help with Data Generator Tool Script & Custom Conditions for Multiple Responses
Hi All,
Hope you are doing well.
I am creating a virtual service using Plain XML Message Responder with Multiple Responses. Below is the snippet.
I have added temporary "Conditions" for my testing purpose.
Arg1 and Arg2 input request elements are required for my validation logic so I have extracted them into DOB and CODE variable using XML Data Bank.
I want to generate two variables OutDate and ID using Data Generator Tool.
For _OutDate _Variable, mentioned the requirement in the "Edit Script" box
For ID variable, mentioned the requirement in the "Edit Script" box
I want to refer DOB and CODE variable from XML Data Bank in Data Generator Tool scripted and set values to OutDate and ID variables.
Based on the ID value, I need to select the "Response" instead of temporary "Conditions".
Could you please help me in this regard?
Kindly let me know if any additional details are needed.
Thanks,
Sati
Comments
-
Hi,
To access a data bank variable in a script use this code.
context.getValue("Generated Data Source", "DOB")
For more information on scripting see this documentation
https://docs.parasoft.com/display/SOA20232/Extensibility+or+Scripting+Basics
Hope this helps!
0 -
Hi William,
Thank you so much, I will try with getValue function.
Also, will go thru the documentation and get back here if I am stuck in the process.
Thanks,
Sati0 -
Hi There,
While I am working on the script coding as suggested by William. I am stuck with one more blocker with date/time format.
I want to format date/time field in "Data Generator Tool" in below format
Date Field Value: Mon Jul 08 04:37:26 UTC 2024
I have mentioned format like MMM dd hh:mm:ss 'UTC' yyyy
It is giving formatting the date field value Jul 08 04:37:26 UTC 2024. Unable to get weekday value (like Mon, Tue..).
Can someone help me with the format code to get weekday value (like Mon, Tue..). ?
Thanks,
Sati0 -
Hi,
I think the Data format is using the Java Date format pattern. So for "Mon" the pattern would be "EEE" to get three letters of the name of the day.
More documentation of the Java Date format pattern can be found here
https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html0 -
Dear William,
It worked, thank you so much
Thanks,
Sati0 -
Glad it worked!
0