motleyjew
03-25-2008, 03:14 PM
I need some assistance parsing some information from a web address. Here is an example of what the web address is.
-http://www.websitename.com/ct20/pages2/client_bcphone_service_order.aspx?client_id=160399 4&contract_document_id=924182&cipid=206123444-
What I am trying to do is get the client ID and the contract id. The client id being 1603994 and the contract id being 924182. Any ideas would be appreciated.
Gregg
ajetrumpet
03-26-2008, 05:40 PM
This will get the job done if the client ID is always 6 characters long and the doc ID is always 6 characters long:mid([Website Field Name], instr([Website Field Name], "client_id="), 6) &
", " & mid([Website Field Name],
instr([Website Field Name], "contract_document_id="), 6)
motleyjew
03-27-2008, 11:03 AM
Thanks for the assistance. Here is what I have got from your suggestion:
ID is the field that the web address is in. I am using "document_id" to id the character location and adding 12 to get my start position.
=Mid([ID],InStr([ID],"document_id=")+12,6)
This does work, but I am not sure if the id is always going to be 6 characters.I assume that it will eventually roll over to 7 but I can't be sure. Is there anyway to do the same type of formula that cuts off at a particular character. I can identify where it would need to end but don't know how this can be done.
ajetrumpet
03-27-2008, 04:19 PM
=Mid([ID],InStr([ID],"document_id=")+12,6)
I am not sure if the id is always going to be 6 characters.I assume that it will eventually roll over to 7 but I can't be sure. Is there anyway to do the same type of formula that cuts off at a particular character.Based on what you've said here, I adjusted the syntax. Use this if you don't know weather the id number will be 6 or 7 characters:=Mid([ID], InStr([ID], "document_id=") + 12,
iif(isnumeric(mid([ID], Instr([ID], "document_id=") + 17, 1)), 7, 6))
motleyjew
03-27-2008, 04:57 PM
Adam,
Thats a great solution , thank you so much. I was not familiar with the isnumeric sytax or that you could use a iif statement within a function like that. I love this forum. Thanks again.
Gregg
ajetrumpet
03-27-2008, 05:40 PM
not a problem. good luck. :)