How can we retain values in an array without destorying previous values - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Interview Questions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Interview-Questions) +--- Thread: How can we retain values in an array without destorying previous values (/Thread-How-can-we-retain-values-in-an-array-without-destorying-previous-values) |
How can we retain values in an array without destorying previous values - kotaramamohana - 06-22-2012 Hi Friends, suppose we have stored 5 values in array. Later we decided to increase array size without destorying previous values. Is it possible to do that. If yes, Can you please share how can we do that? For your understanding i am giving one Example: Code: a=array("a","b","c","d","e") RE: How can we retain values in an array without destorying previous values - Ankesh - 06-22-2012 You need to preserve the array elements using preserve keyword. Use Redim Preserve a(15) Regards, Ankesh RE: How can we retain values in an array without destorying previous values - ssvali - 06-22-2012 Use "Preserve" keyword to retain value Below is the example Code: a=array("a","b","c","d","e") RE: How can we retain values in an array without destorying previous values - kotaramamohana - 06-22-2012 Thanks Ankesh and SSvali, Its working fine |