05-07-2013 02:49 PM
hi,
I have declared variable A as a string
if(locals.A)!="N/A"
passs some conditions
else
fails.
I am getting error at if statment line...pls let me know how to compare the sting value
thanks,
chethan
05-08-2013 07:28 AM
Locals.a!="N/A"
Put this in the if statement i.e.
if(Locals.a!="N/A")
If this does not then pls attach sequence.
05-08-2013 08:16 AM - edited 05-08-2013 08:18 AM
thanks for your reply....
Sorry i didn't give complete details in previous post....
The requirement is as follows
Parameters.tar_str (tar_str is declared as string array under parameter)
Foreachloop
Array to Iterate : Parameters.xxx (xxx is declared as string array)
Current element : locals.Currentelement (Current element is declared as local variable)
Current offset : locals.Currentoffset (Current Offset is decalred as Local variable)
locals.tar_name (tar_Name is decalred as local string to transfer current offset string of each index)
locals.tar_name = Parameters.tar_str[locals.currentoffset] -----> here i am getting error as "specified value does not have the expected type. this value will cause run-time error"
Note if i use str(locals.tar_name)== Parameters.tar_str[locals.currentoffset] --> here i don't get error , so i need to know which statement is correct
if(locals.tar_name!="N/A")
{
pass some conditons
else
fails condition
}
this is my requirement. Pls let me know the solution
I tried strcmp in if conditon loop but i got error...FYI
05-08-2013 10:19 AM
Are you trying to use the "If' step type or are you trying to do this in a single expression. If you are trying to do this in a single expression then you need to use the conditional operator '?'.
It's equivalent to how that operator works in C/C++ and it works as follows:
(conditional Expression) ? (Expression to execute if true) : (Expression to execute if false)
-Doug
05-08-2013 01:48 PM - edited 05-08-2013 01:49 PM
as I mentioned in previous post, i want to compare using if condition step type not expression.......I would also like to know the solution wherever i am getting error whcih is explianed in my previous post.....Pls let me know.....
05-09-2013 06:24 PM
Hello Mandya,
Have you seen the TestStand shipping example UsingFlowControlSteps.seq
? This example demonstrates in detail how to set up flow control steps. The default location for this example is <TestStand>\Examples\SequenceFlow\
.
Please take a look at this example, and adapt your application to fit the If
and Else
steps shown.
Warm Regards,
05-10-2013 10:45 AM - edited 05-10-2013 10:50 AM
See next post.
05-10-2013 10:47 AM
regarding:
locals.tar_name = Parameters.tar_str[locals.currentoffset] -----> here i am getting error as "specified value does not have the expected type. this value will cause run-time error"
Note if i use str(locals.tar_name)== Parameters.tar_str[locals.currentoffset] --> here i don't get error , so i need to know which statement is correct
It sounds like locals.tar_name isn't really a string. If it was a string you would not need to do str().
-Doug
05-10-2013 01:14 PM
ok..thanks for you reply.....