# Thread: Differentiating Alpha from Numeric in a data driven test

1. ## Differentiating Alpha from Numeric in a data driven test

hello,

am currently using data driven.. and i need to check a field if its alpha char or numberic that i got from the table.. can anyone please help? Thanks.

e.g. "01" from "AA" or "A2"

2. ## Re: Differentiating Alpha from Numeric in a data driven test

You could use regular expressions or write code to filter on on the ascii code. Note that the fact a test is data driven has nothing to do with the ascii value of data you are examining.

3. ## Re: Differentiating Alpha from Numeric in a data driven test

I tend to use the XL functions for this sort of thing
Set up a cell with isnumber looking at another cell. Write you var to this and read the result from xl function.

4. ## Re: Differentiating Alpha from Numeric in a data driven test

hi guys..can you please elaborate more? like giving samples....i'd really appreciate it [img]images/icons/smile.gif[/img]

5. ## Re: Differentiating Alpha from Numeric in a data driven test

what are xl functions?

6. ## Re: Differentiating Alpha from Numeric in a data driven test

I made this short code... can anybody comment on it? Is there a loophole?

word = "22S";
i=1;
j=1;

while i<=length word &#0124;&#0124; j==1
{
word2= substr word,i,1 ;
word3= ascii word2;
if word3 < 48 &#0124;&#0124; word3 > 57
{
j=2;
report_msg "string is not numeric";
}
i++;
}

7. ## Re: Differentiating Alpha from Numeric in a data driven test

word = "22S";
if (match(word,".*[A-Za-z].*"))
report_msg ("string is not numeric");

8. ## Re: Differentiating Alpha from Numeric in a data driven test

Sorry can't provide code as I do not have access to wr.
XL functions are entries in the cells in the microsoft application known as Excel aka XL or xl if I forge the caps. These usually start with "=" and can be used to add things together =sum. Make compare =if(..) up to 16 levels I believe =isnumber() to see if something is a number =now() to get the PC date/time and several hundreds of others.
Using WR DDT functions can pop variables into cells and you can read the results. Cunning application of skills in this area does away with any need to most of the WR check points for test validation.
You can have an expected result in one col you can write you actual to another and then do the test in a third. This also provide evidence of testing and or test results also eliminating wr reporting.

9. ## Re: Differentiating Alpha from Numeric in a data driven test

bpolitzer: just want to clarify... is
".*[A-Za-z].*" a wildcard?

10. ## Re: Differentiating Alpha from Numeric in a data driven test

Yes, in TSL it's known as a regular expression.

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.