Micro Focus QTP (UFT) Forums
How to Split dynamic number - 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: How to Split dynamic number (/Thread-How-to-Split-dynamic-number)



How to Split dynamic number - SS001 - 06-02-2010

Hi,
If i submit an order, an order number with shipment details will be provided. The shipment Id is a dynamic generated value. I fetched that value from database and stored it in datatable.
eg:
Shipment_ID=BEN23599012

I want to pass partial (shipment Id) number as a variable for a field to search an order based on shipment Id.
I have tried,
Code:
For i = 1 to 5
split_ship=split(Datatable.Value("Shipment_ID",dtGlobalSheet),i)
Next

I may be wrong.
can you help me

Thanks in advance


RE: How to Split dynamic number - Saket - 06-02-2010

if i am getting it right you want to split it like 'Shipment_ID' and 'BEN23599012', if so split it like
Code:
split_ship = split(Datatable.Value("Shipment_ID",dtGlobalSheet),"=")



RE: How to Split dynamic number - SS001 - 06-02-2010

Saket,

The value will be BEN23599012. I want to send a partial number as a variable to another field.How to split this continuos number?


RE: How to Split dynamic number - Saket - 06-02-2010

what exactly you are referring for partial number? do you need to split the alphabets and numbers?


RE: How to Split dynamic number - SS001 - 06-03-2010

It is a dynamic number. Sometime it may be only numbers and sometimes alpha numeric. whatever the value is, i want first 5 characters to be passed as a variable. can you please help me with that.


RE: How to Split dynamic number - Saket - 06-03-2010

if this is the case..to get the first 5 character, you should use 'LEFT'

e.g.
Code:
Str = "ABC12345678"

sValue = Left(Str,5)
msgbox sValue



RE: How to Split dynamic number - SS001 - 06-03-2010

Saket,

Thanks a lot. The logic you said, works fine.Smile