Page 1 of 1

How to handle null values in the data source.

Posted: Mon Feb 22, 2016 11:22 pm
by PSingh
Hi,
How do you make your module to iterate when you have null values in your data table (source).
Let me know.
Thanks on advance!

Re: How to handle null values in the data source.

Posted: Tue Feb 23, 2016 9:04 am
by odklizec
Hi PSinght and welcome here,

If you just need a plain repetition of a module, without the need to get some data from the data connector, all you need to do is to create a test case with simple data connector containing some empty lines. Number of lines = number of repetitions. That's all.

Re: How to handle null values in the data source.

Posted: Tue Feb 23, 2016 4:15 pm
by krstcs
Along with what Pavel said, without more information it is very difficult to know exactly what you are trying to accomplish.

Please elaborate on your desired goal and perhaps the framework of the SUT, etc.

Re: How to handle null values in the data source.

Posted: Tue Feb 23, 2016 9:29 pm
by PSingh
Thanks for getting back to me!

Actually I do need to get data from the data connector. And my data source has some null values too. I have attached a dummy file. I have to submit a claim for each member. When I run my test case, claims for 2nd and 3rd row actually submits the claims but rows 1, 4, 5 claims do not get submitted because of the null value issue and report does not mention any error.
Please see the attached file.

Let me know if it makes sense.

Thanks once again!

Re: How to handle null values in the data source.

Posted: Tue Feb 23, 2016 10:33 pm
by krstcs
My assumption is that you want to skip over actions where the data value is null. To do that you are going to need to use some custom code in a user code module. You will need to use an if() block to determine what parts to execute.

Code: Select all

public void MergedCode(string dataValue) {
  if (dataValue != null && !dataValue.Equals("")) {
    //do your stuff here
  }
}

Re: How to handle null values in the data source.

Posted: Thu Feb 25, 2016 8:29 pm
by PSingh
Thanks you so much. That works!
But ran into another issue.
If I have to specify the location( example -lower right, upper right etc) of a submit button , see code blow. How do you specify the location. Let me know.
Thanks once again!

var submitClaims = repo.SecuredInternalLogin.SubmitClaims;

Re: How to handle null values in the data source.

Posted: Thu Feb 25, 2016 9:14 pm
by krstcs
You should not have to specify the location. If you setup your XPath correctly for your button's repository element, Ranorex will find it no matter where it is.

Can you post the actual XPath you are using and a Ranorex Snapshot of the element/page?