473,657 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse record, convert to session variables

Greetings,

I have a database with records that contain data like the following:

"vendor" - "phone number" - "city", "state" "problem."

For example:
xyzcompany - 800-123-4567 - new york, ny tp.

The line above is one record, the company names will differ (but are
limited to a dozen), the format of the number will always be with a dash
seperating the area code and number, the city and state will be in
place, and the problem will be a two letter code followed by a period.

I need to be able to parse that record into seperate session variables
such as Session("vendor "), Session("area_c ode"), Session("number "), and
on with the city, state, and problem.

What is the best method to use in VBScript/ASP to break this record down
into pieces?

I appreciate any help you can give.

Thanks,
Brandon
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
5 1413
You say the data below is a record - assuming that you are still able to
address the individual fields, use something like:

For Each objField In objRS.Fields

Session (CStr(objField. Name)) = CStr(objField.V alue)

Next

- or are you asking how to split a single string??
"Brandon" <bdreilingATmac .com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Greetings,

I have a database with records that contain data like the following:

"vendor" - "phone number" - "city", "state" "problem."

For example:
xyzcompany - 800-123-4567 - new york, ny tp.

The line above is one record, the company names will differ (but are
limited to a dozen), the format of the number will always be with a dash
seperating the area code and number, the city and state will be in
place, and the problem will be a two letter code followed by a period.

I need to be able to parse that record into seperate session variables
such as Session("vendor "), Session("area_c ode"), Session("number "), and
on with the city, state, and problem.

What is the best method to use in VBScript/ASP to break this record down
into pieces?

I appreciate any help you can give.

Thanks,
Brandon
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
Alan Howard wrote:

For Each objField In objRS.Fields

Session (CStr(objField. Name)) = CStr(objField.V alue)

Next


CStr is unnecessary with [Name]...
http://msdn.microsoft.com/library/en.../mdproname.asp
....and possibly unwanted with [Value], depending on the data type.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
If your format and delimiters are fixed (unchanging) then

a1 = split( strRecord, ",")
a2 = split( a1(0), "-")
a3 = split( a1(1), " ")

vendor = a2(0)
areacode = a2(1)
phonenum = a2(2) & "-" a2(3)
city = a2(4)
state = a3(0)
prob = a3(1)
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Brandon" <bdreilingATmac .com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Greetings,

I have a database with records that contain data like the following:

"vendor" - "phone number" - "city", "state" "problem."

For example:
xyzcompany - 800-123-4567 - new york, ny tp.

The line above is one record, the company names will differ (but are
limited to a dozen), the format of the number will always be with a dash
seperating the area code and number, the city and state will be in
place, and the problem will be a two letter code followed by a period.

I need to be able to parse that record into seperate session variables
such as Session("vendor "), Session("area_c ode"), Session("number "), and
on with the city, state, and problem.

What is the best method to use in VBScript/ASP to break this record down
into pieces?

I appreciate any help you can give.

Thanks,
Brandon
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4
> CStr is unnecessary with [Name]...
...and possibly unwanted with [Value], depending on the data type.
Habit - easier than second-guessing variant sub-types.

Alan

"Dave Anderson" <GT**********@s pammotel.com> wrote in message
news:Oh******** *****@TK2MSFTNG P12.phx.gbl... Alan Howard wrote:

For Each objField In objRS.Fields

Session (CStr(objField. Name)) = CStr(objField.V alue)

Next
CStr is unnecessary with [Name]...
http://msdn.microsoft.com/library/en.../mdproname.asp
...and possibly unwanted with [Value], depending on the data type.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #5
Thanks, that did the trick!

Brandon
_______________ _______________ ___________

If your format and delimiters are fixed (unchanging) then

a1 = split( strRecord, ",")
a2 = split( a1(0), "-")
a3 = split( a1(1), " ")

vendor = a2(0)
areacode = a2(1)
phonenum = a2(2) & "-" a2(3)
city = a2(4)
state = a3(0)
prob = a3(1)
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4914
by: Mark | last post by:
I have a working PHP/MySQL application used for data entry. The data entry screen includes a "Save" button. The PHP code for this button looks like this: if (isset($_POST)) { if ($_POST == "") { include ("InsertRecord.inc"); // Insert new record }
6
6080
by: nate | last post by:
Hello, Does anyone know where I can find an ASP server side script written in JavaScript to parse text fields from a form method='POST' using enctype='multipart/form-data'? I'd also like it to parse the filename. <form name='form1' method='POST' enctype='multipart/form-data' action='sub.asp'> <input type='text' name='title1' value='value1'> <input type='file' name='file1'>
5
3328
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example I'm adding a customer. The Customer fields are mostly foreign keys that refer to primary keys in other tables, left join instead of junction tables at this point. So, when I want to add a customer record, I also need to add records to the other...
10
3499
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
3
1344
by: Alison Givens | last post by:
Hi, I want two Session values in my record selection query. The come out of an other webform. When I do it hardcoded, it works. How dow I do this with the Session values? Hardcoded: Dim strSQL As String strSQL = "ToText({AlleProductieveProjectUrenVerdeeldOverFilialen.Periode})
1
2006
by: nicepg | last post by:
Hi, i m new in C#, and i m trying to prgramm a calculator program in web application. My program work very well using a static variables but i need to change these variables to session variables.. my static variables are:
18
3432
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts the usefullness of using session state management. I probably missed it somewhere - can...
1
2400
by: andy | last post by:
I have several forms with formviewa on them. When a new record is inserted the users want to see the readonly version of that record. Default behaviour is to show the first record in the collection. So if there are 5 entries and the user adds a 6th they want to see the 6th rather than the 1st after it's added. Changing the criteria for the collection they see is not an option. My quick and dirty solution is to sort on descending id so...
9
2574
by: _Who | last post by:
I have a .htm file that shows in an iframe which is part of a master's asp:Content. I need the .htm to copy the style class from the master or set it as shown below. Below is how I set the stylesheet in the master. What I'd like to do, is change that code into javascript and run it in the
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.