Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Concatenation operator in Vbscript
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi ppl,
I am using descriptive programming to click a record from my database. since there are no unique properties i tried to hard code the value

say my html id is xyz_0_1 where 0 & 1 indicates row and column respectively.. i need to store "xyz_" in a variable and dynamically change "0_1" .how do i do it

i stored xyz in a variable a

and then 0_1 in another variable b. i concatenated both by mentioning as a & b
but the msgbox displays the a&b and not the values stored in it.Where have i gone wrong.pls correct me
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Please write your code here.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
a="xyz"
b=_1

c= a & b

msgbox c

msgbox displays a&b instead of the values. i know that i have gone wrong in the third step while concatenating.pls correct me

sorry abt the duplicate thread
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
not sure how are you getting such result, checkout your code properly.
you should use, either use b = 1 or b = "_1", instead b = _1

Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi
Correct Approach is below:

Code:
a="xyz"
b="_1"
c= a & b

msgbox c

~Regards
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi all,
I have an approximately same issue, the idea is that I am getting a value from DB which is assigned to a variable, e.g. Requested_Field.
the format of this value is e.g.: 126991.55 (it have an ".")
then to the second variable is assigned another value, which is got from the application, it's value is for e.g. the same but format is another: 126,991.55 (with "," and ".").
when I am comparing them, I'm getting an error, this is because the formats are different: the report added by me when comparison fails is:
The variable1: '126991.55' is not the same as variable2: '126,991.55'! Please check manually!

Can anyone help me to remove the "," from first variable, I don't know which statement should be used to remove some specific chars(the chars I want) from a string or a variable..
Please can anyone help me?
Reply
#7
Solved: 11 Years, 4 Months, 3 Weeks ago
You could use a double instead of string, but if you want to use strings and must remove the comma....

Code:
a1 = "123,456.78"
a1 = replace(a1,",","") 'replaces the comma with a blank

Just in case you were wondering about the double method
Code:
a1 = cdbl("123,454.56")
Reply
#8
Solved: 11 Years, 4 Months, 3 Weeks ago
Thanks a lot man, I found it and it's working.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How do we use OR operator with Desc Programming. anu05446 3 2,348 01-07-2014, 01:36 PM
Last Post: anu05446
  workaround for addition airthmetic operator krr 1 1,810 01-06-2013, 04:13 AM
Last Post: kordirko
  String Concatenation send2aarti 0 3,186 08-26-2010, 09:22 PM
Last Post: send2aarti

Forum Jump:


Users browsing this thread: 1 Guest(s)