if condition throwing type mismatch error - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners) +--- Thread: if condition throwing type mismatch error (/Thread-if-condition-throwing-type-mismatch-error) |
if condition throwing type mismatch error - rrdamuluri - 11-04-2010 Hi, I am gettingtype mismatch errror when I run the following code's if condition. can some one tell me what is wrong in my code. Attached error image. And one more thing I have another attribute primary="true" which is optional and may not show up for all the image nodes also have to be in if condition. How to code that Code: Set urinode=xmlDoc.SelectSingleNode(imgcat) RE: if condition throwing type mismatch error - PrabhatN - 11-04-2010 Hi, Instead of "&", use "AND". Actually in VB, "&" operator is used to concatenate 2 Strings. Now your code should look like Code: If ((imgcategory="Poster Art") AND (imgwidth="72") AND (imgheight="108")) then The code below doesn't provide enough information about what you want to do or how you want to include it in the IF condition. Please provide a good description Quote:And one more thing I have another attribute primary="true" which is optional and may not show up for all the image nodes also have to be in if condition. How to code that RE: if condition throwing type mismatch error - rrdamuluri - 11-04-2010 Thanks Prabath AND works. And for the one you asked clarification: I have a node image which may or may not have attribute primay.When ever it is available I want to add a column in excel that it exists. This is the xml node without primary attribute Code: <image type="image/jpg" width="432" height="288" category="Poster Art"> Code: <image type="image/jpg" width="288" height="432" primary="true" category="Poster Art"> And the code I wrote was Code: If ((imgcategory="Poster Art")AND(imgwidth="72")AND(imgheight="108")) then |