Micro Focus QTP (UFT) Forums

Full Version: How to Split dynamic number
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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),"=")
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?
what exactly you are referring for partial number? do you need to split the alphabets and numbers?
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.
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
Saket,

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