Forum Discussion
SmartBear_Suppo
15 years agoSmartBear Alumni (Retired)
Hello!
If I understand you correctly, importing the empty value from excel causes an empty value to be sent, instead of a null value, which is what you need it to send?
If so, you can replace the empty element with a null value using an Event Handler.
Go into the "Events" tab in the main Project window and add a new handler for RequestFilter.filterRequest. Either leave the "Target" field empty for this to run on all requests, or specify the name of a TestStep for it to run only on that one TestStep.
Then enter the following script:
which will do a simple string replace on the request content right before it is sent. If this particular element is empty, it will replace it with a null value (you could also strip it out entirely if you wanted). Hope this is what you needed! Good luck!
Regards,
Dain
eviware.com
If I understand you correctly, importing the empty value from excel causes an empty value to be sent, instead of a null value, which is what you need it to send?
If so, you can replace the empty element with a null value using an Event Handler.
Go into the "Events" tab in the main Project window and add a new handler for RequestFilter.filterRequest. Either leave the "Target" field empty for this to run on all requests, or specify the name of a TestStep for it to run only on that one TestStep.
Then enter the following script:
context.requestContent = context.requestContent.replace('<het4:Date></het4:Date>', '<het4:Date xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>')
which will do a simple string replace on the request content right before it is sent. If this particular element is empty, it will replace it with a null value (you could also strip it out entirely if you wanted). Hope this is what you needed! Good luck!
Regards,
Dain
eviware.com