What is the difference between Dim And Redim
Answers were Sorted based on User's Feedback
Answer / ravi_kanakam
Dim statement is used to formally declare a variable, where
as ReDim statement is used to resize a dynamic array that
has already been formally declared.
| Is This Answer Correct ? | 97 Yes | 9 No |
Answer / paayal
Dim is a data type(variant) that user can assign to a
variable like Dim User
User = "QTP"
Redim can be use to reinitialize the variable. We can give
a new value to the same variable and can use it again in
the script.
| Is This Answer Correct ? | 59 Yes | 16 No |
Answer / deepa
Dim Statement
Declares variables and allocates storage space.
Dim varname[([subscripts])][, varname[([subscripts])]] . . .
Variables declared with Dim at the script level are
available to all procedures within the script. At the
procedure level, variables are available only within the
procedure.
You can also use the Dim statement with empty parentheses
to declare a dynamic array. After declaring a dynamic
array, use the ReDim statement within a procedure to define
the number of dimensions and elements in the array. If you
try to redeclare a dimension for an array variable whose
size was explicitly specified in a Dim statement, an error
occurs.
ReDim Statement
Declares dynamic-array variables, and allocates or
reallocates storage space at procedure level.
ReDim [Preserve] varname(subscripts) [, varname
(subscripts)] . . .
The ReDim statement is used to size or resize a dynamic
array that has already been formally declared using a
Private, Public, or Dim statement with empty parentheses
(without dimension subscripts). You can use the ReDim
statement repeatedly to change the number of elements and
dimensions in an array.
If you use the Preserve keyword, you can resize only the
last array dimension, and you can't change the number of
dimensions at all. For example, if your array has only one
dimension, you can resize that dimension because it is the
last and only dimension. However, if your array has two or
more dimensions, you can change the size of only the last
dimension and still preserve the contents of the array.
The following example shows how you can increase the size
of the last dimension of a dynamic array without erasing
any existing data contained in the array.
ReDim X(10, 10, 10)
. . .
ReDim Preserve X(10, 10, 15)
Caution If you make an array smaller than it was
originally, data in the eliminated elements is lost.
| Is This Answer Correct ? | 20 Yes | 7 No |
Answer / sabitha reddy
Dim statement is used to declare a variable
The redim statement is used to change the array size within the script,
for example..
if we have declared an array dim customer (30)
but after that we want to change the size of the array , we can do it with the help of Redim statement
like-Redim customer(100)
| Is This Answer Correct ? | 14 Yes | 5 No |
what function you write to do database testing with the help of qtp?
What r types of parametarizations?
w is descriptive programming
how can we compare descriptive programing with a regular expression
If I want to run more than one test (With different functionality) with in one script, then what i do? plz. explain with any example.
Hi I'm a beginner in QTP. So far I'm ok with Descriptive but stuck while implementing Hybrid Frame work. 1. I have created a Keyword file with .vbs ext set home=description.create home("title").value="Welcome to feests" set reglink=description.create reglink("name").value="register yourrestaurant / take away" set fbusname=description.create fbusname("name").value="business_name" set dispname=description.create dispname("name").value="display_name" set restchkbox=description.create restchkbox("name").value="restaurant" set cuiscate=description.create cuiscate("name").value="cuisine_categery1" set addline1=description.create addline1("name").value="address_line1" set pstcode=description.create pstcode("name").value="address_postcode" set cntry=description.create cntry("name").value="address_country" set mlandno=description.create mlandno("name").value="landline_no" set emailadd=description.create emailadd("name").value="email" 2. I have created an Function Library file as follows Function launch() bro="C:\Program Files\Internet Explorer\iexplore.exe" url="http://www.feests.com/" invokeapplication bro&" "&url Browser(home).page(home).Link(reglink).click End Function Function restregistration(karthik, teja, Ameerpet, UK) Browser(home).page(home).WebEdit(fbusname).set "karthik" Browser(home).page(home).WebEdit(dispname).set "teja" Browser(home).page(home).WebCheckBox(restchkbox).set "ON" Browser(home).page(home).WebList(cuiscate).Select "Indian" Browser(home).page(home).WebEdit(addline1).set "Ameerpet" Browser(home).page(home).WebEdit(pstcode).set "UK" Browser(home).page(home).WebList(cntry).select "United Kingdom" Browser(home).page(home).WebEdit(mlandno).set "023775347" Browser(home).page(home).WebEdit(emailadd).set "email@gmail.com" End Function 3. This is how I have called the keywords and Functions in QTP executefile"C:\Documents and Settings\karthik\Desktop\keywords.vbs" executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs" launch restregistration karthik, teja, Ameerpet, UK, "email@gmail.com" Now the issue is, I'm trying to enter the email ID in WebEdit field. But I dont know what is the mistake I did, if I run the script in QTP it is showing following error Error: Expected identifier Line (2): "executefile"C:\Documents and Settings\karthik\Desktop\functions.vbs"". Can someone help me fix this, please!!?
Write code for ,We have a web table with rows and columns like EmpID EName Action 1 ABC Edit Delete 2 XYZ Edit Delete 3 PQR Edit Delete In the above Table the last column has two links we have to click first link based up on EmpID =2
how can we retrieve ten rows from the data table using loop concept?
Explain how qtp identifies objects?
Explain different types of checkpoints?
How to connect to data base?
Why we are going for descriptive programming ? I answered as 'If objects are not present in OR we will go for descriptive Programming'? Is this correct ?