abt filter function

if iam using below two statments its ok
My = Array ("Apples","Oranges", "Apricots")
MyResult = Filter(My, "Oran")

if i use msgbox MyResult

it shows type mismatch
plz help me

Answer Posted / lakshmi

Boss,

Filter function will a zero-based 1-D array. so we have to
use subscript.Filter function may return more than one
matches. then u have to take a loop (for or while) and u
have repeat this loop until ubound of that array.So in u r
case, please see the answer below:

My = Array ("Apples","Oranges", "Apricots")
MyResult = Filter(My, "Oran")
Msgbox MyResult(0)

Here i was mentioed subscript as 0 as we have only one item
which matcehs with u r search.
If there is more than one match, then u have to do likt
this.

My = Array ("Apples","Oranges", "Apricots")
MyResult = Filter(My, "Oran")
For i=0 ubound(MyResult)-1
Msgbox MyResult(i)
Next.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to idetfy which test cases are automated?who will deside that plz tell me

1539


What is ‘object spy’ and what is the function of object spy in qtp?

578


Explain the qtp test phases.

621


iam have done mba(finance)in 2008. in 2008 one reputed consultancy came off campus interview our institution. i got job as "manual test engineer". now iam working as "manual testing engineer". now my problem is when iam going interview the interviewer asking like " ur mba gradute how can u get job in test engineer." this question i have faced every interview. iam explaining how iam getting job. but they are not trust me". pls tell me answer how i am giving relavent ans.. this is my mail id y.ramana84@gmail.com

1402


How do you send email with attachment from outlook using qtp ?

567






Explain how to use QTP to check broken links on a page?

591


What is the process of synchronizing qtp and aut?

574


Hello friends..... On which areas of an application we can not test with QTP

1561


write a script to validate the content in the web application. (do it by OR method) and (do it by Descriptive method by creating a description object.. (give a filter condition only WEbelement- not easy need to use some more property while giving filter condtions- use google for your help...))

1507


can i compare two databases using QTP ?

1888


How QTP identify the system time that's changes every seconds?

600


hi all can anyone explain how to write the code for finding the mandatory columns in table which are having (red*) (red Astrik)

1406


If a button named "CLICK" is recorded in low level recording mode , what will be the values stored for "name" property of that button in object repository ?

1747


When using descriptive programming?

641


Difference between test object and run time object?

596