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 is XML checkpoint in QTP. How we can use in Web Based application
What are the challenges do we face while testing webbased applcations using the automation tool QTP or any?
What is the extension of qtp local repository?
1. What is extense of Result file in QTP?
How to extract the data in the below scenario and dump it in the excel? Link1 Link2 Link3 Link4 numberlink1 text text text numberlink2 text text text numberlink3 text text text numberlink4 text text text So, Here is my question? -- It is a matrix but is not a web table(QTP does not recognize it as a web table) -- Link1, link2 and link3 are links under which text is available -- numberlink1 to numberlink4 are again LINKS -- All the others displayed are text only I want to extract the data in the above scenario and dump it into an excel in the same scenario as it is displayed above. Kindly help.. Thank you
You say it is a bug but developer say it is not a bug then what will you do?
7 Answers Hewitt, Tech Mahindra,
Can we select add ins in UFT during run time
how to write the descriptive programming in QTP for remove the object value and substitute, with a variable then call the validation from excel
What are software testing metrics
i am testing an online shopping application.I CLICK on a link "ADD TO CART" of that application a "new page" is open and then click on any object of that "new page". after that when i run this SCRIPT then on this "new page" QTP always shows error of "OBJECT NOT FOUND". How i solve this problem ?
Hi All, I am using QTP for one of the Desktop application which uses Keyboard inputs like 'Tab ,F7 etc' and also mouse (Click). After recording when i am running the Script ,it is not able to recognize the keyboard inputs like F7,Tab and mouse Click because of which either i have to skip that part or manually do the inputs. Please answer how can i make script more flexible so that it will recognize both keyboard and mouse operations.
What is creation time property and how does it work?