473,793 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing Data in ASP

I have a select statement that gives me the following results (for
example) "test documentation/software product version document.doc" I
need to parse the data to only grab everything between the "/" and
".". So, in other words, "software product version document" - I have
absolutley no idea how to do this - can anyone help????

Thanks in advance!
Lisa
Jul 19 '05 #1
9 1959
Lisa wrote:
I have a select statement that gives me the following results (for
example) "test documentation/software product version document.doc" I
need to parse the data to only grab everything between the "/" and
".". So, in other words, "software product version document" - I have
absolutley no idea how to do this - can anyone help????

Thanks in advance!
Lisa

I need to ask: is this truly represtative of your data? Could there be more
than one "/", or more than one "."? If so, you need to let us know if you
want the parsing to start at the first or last incidence of each character.

Do you need the Select statement to return the entire string? If not, then
let us know what database type and version you are using so we can show you
how to do it in your query.

If you need both the entire string, and you need to parse it as well, then
you will be better off doing it in vbscript in your asp page.
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
Bob,
Yes that is an actual representative of my data. The only "variable"
would be anything betweem "/" and ".". An actual example of my select
results is: "Testing Documentation/Borland JBuilder 6.0 Validation
Document.doc"

My code looks like this:
Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufac turer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateOb ject("Adodb.com mand")
Set OBJcmd.ActiveCo nnection = oConn OBJcmd.CommandT ext = "SELECT * FROM
DocMd WHERE URL LIKE '%" & strOldDocName & "%' ORDER BY URLID DESC;"
Set rs = OBJcmd.execute

fullfilename = rs.Fields("URL" )- this is was generates the data
mentioned above.

strIncremental = FullFileName + "1"

I need "strIncremental " to actually equal Parsed(FullFile Name) + 1

If NOT rs.EOF THEN
GetFileName = strIncremental
Else
GetFileName = strOldDocName
End If

Lisa

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
Lisa . wrote:
Bob,
Yes that is an actual representative of my data. The only "variable"
would be anything betweem "/" and ".". An actual example of my select
results is: "Testing Documentation/Borland JBuilder 6.0 Validation
Document.doc"
You see? There are two "."'s there. Will it always be the last "." that you
want?

My code looks like this:
Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufac turer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateOb ject("Adodb.com mand")
Set OBJcmd.ActiveCo nnection = oConn OBJcmd.CommandT ext = "SELECT *
Don't be lazy. Avoid select * in production code:
http://www.aspfaq.com/show.asp?id=2096
FROM DocMd WHERE URL LIKE '%" & strOldDocName & "%' ORDER BY URLID
DESC;" Set rs = OBJcmd.execute

fullfilename = rs.Fields("URL" )- this is was generates the data
mentioned above.


Will you be doing anything else with fullfilename besides parsing it? Based
on this code, the answer is no, but there may be code you haven't shown us

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #4
You see? There are two "."'s there. Will it always be the last "." that
you
want?
I see your point. Yes I will always want the last "." in the string

and that will be my only referrence to FullFileName.

Lisa

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Lisa . wrote:
You see? There are two "."'s there. Will it always be the last "."
that you
want?
I see your point. Yes I will always want the last "." in the string

and that will be my only referrence to FullFileName.

Lisa

What database are you using? This can probably be done in your query.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #6
Is it possible to check Hotmail email with an ASP?
Jul 19 '05 #7

sorry I thought I posted my database info in my last message... I'm
using SQL 7

~L~
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #8
Lisa . wrote:
sorry I thought I posted my database info in my last message... I'm
using SQL 7

~L~


OK, here's a SQL 7+ solution (you should probably encapsulate this in a
stored procedure rather than using dynamic sql):

Dim sSQL
sSQL = Select substring(REVER SE(Right(revers e(URL), " & _
"len(URL) - charindex('.',R EVERSE(URL)))), charindex('/',URL) " & _
"+ 1,100) as filename FROM DocMd WHERE URL LIKE '%" & _
strOldDocName & "%' ORDER BY URLID DESC;"
'for debugging:
'response.write sSQL
Set rs=oConn.Execut e(sSQL,,1)
parsedFilename = rs("filename")

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #9
Bob,
I found what I was looking for....thought I would share, thanks!

Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufac turer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateOb ject("Adodb.com mand")
Set OBJcmd.ActiveCo nnection = oConn
OBJcmd.CommandT ext = "MY SELECT STATEMENT;"
Set rs = OBJcmd.execute

fullFileName = rs.Fields("URL" )
Dim text, found, arrText, newDoc
text = fullfilename
arrText = Split(text,"/")
For each item in arrText
if InStr(item,".do c") > 0 then
newDoc=replace( item,".doc","")
end if
next
strIncremental = newDoc + "1"
If NOT rs.EOF THEN
GetFileName = strIncremental
Else
GetFileName = strOldDocName
End If

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

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

Similar topics

7
3002
by: Kylotan | last post by:
I have a text file where the fields are delimited in various different ways. For example, strings are terminated with a tilde, numbers are terminated with whitespace, and some identifiers are terminated with a newline. This means I can't effectively use split() except on a small scale. For most of the file I can just call one of several functions I wrote that read in just as much data as is required from the input string, and return the...
8
9448
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
3
3071
by: Girish | last post by:
Hi All, I have written a component(ATL COM) that wraps Xerces C++ parser. I am firing necessary events for each of the notifications that I have handled for the Content and Error handler. The events can then I am able to parse XML input in the form of files. I also have provided support for parsing of XML content in the form of string data. I am able to do so by creating a MemBufInputSource object using the XML content provided to the...
4
2659
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. <txtNameUSState>CALIFORNIA</txtNameUSState>
3
3508
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story> <story_id>112233</story_id> <pub_name>Puleen's Publication</pub_name> <pub_code>PP</pub_code> <edition_date>20031201</edition_date>
1
2429
by: yonido | last post by:
hello, my goal is to get patterns out of email files - say "message forwarding" patterns (message forwarded from: xx to: yy subject: zz) now lets say there are tons of these patterns (by gmail, outlook, etc) - and i want to create some rules of how to get them out of the mail's html body. so at first i tried using regular expressions: for example - "any pattern that starts with a <p> and contains "from:"..." etc.
9
4063
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics" portions of Babe Ruth page (http://www.baseballprospectus.com/dt/ruthba01.shtml) and store that info in a CSV file. Also, I would like to do this for numerous players whose IDs I have stored in a text file (e.g.: cobbty01, ruthba01, speaktr01, etc.)....
5
4308
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
3
4386
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in the file) with the location. And for a particular section I parse only that section. The file is something like, .... DATAS
13
4516
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple command set consisting of several single letter commands which take no arguments. A few additional single letter commands take arguments:
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
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
10161
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
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
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...
0
6777
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();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.