How to handle null values in the data source.

Ask general questions here.
PSingh
Posts: 4
Joined: Mon Feb 22, 2016 10:38 pm

How to handle null values in the data source.

Post by PSingh » Mon Feb 22, 2016 11:22 pm

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!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Tue Feb 23, 2016 9:04 am

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

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

Post by krstcs » Tue Feb 23, 2016 4:15 pm

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.
Shortcuts usually aren't...

PSingh
Posts: 4
Joined: Mon Feb 22, 2016 10:38 pm

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

Post by PSingh » Tue Feb 23, 2016 9:29 pm

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!
Attachments
2016-02-23_12-54-06.png
2016-02-23_12-54-06.png (149.7 KiB) Viewed 610 times

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

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

Post by krstcs » Tue Feb 23, 2016 10:33 pm

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
  }
}
Shortcuts usually aren't...

PSingh
Posts: 4
Joined: Mon Feb 22, 2016 10:38 pm

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

Post by PSingh » Thu Feb 25, 2016 8:29 pm

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;

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

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

Post by krstcs » Thu Feb 25, 2016 9:14 pm

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?
Shortcuts usually aren't...