473,729 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse one field's data into multiple fields

I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail

Please help

Nov 13 '05 #1
5 3586
On 21 Feb 2005 12:51:05 -0800, <jl********@mss ystems.com> wrote:
I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail


You may not want to use Right() if your field has 'irregular' data like
your first one above. You should use the Mid() function. Does your third
data segment always begin at the 13th position ... or is the best you can
say that it is always after the second semi-colon?

Before you answer that, ask yourself, is there any way to NOT put this
data in the same field to begin with? It looks like it should be in three
separate fields. Second, is there any way to eliminate irregular data,
which would certainly make it easier to extract.
Darryl Kerkeslager

Nov 13 '05 #2
On 21 Feb 2005 12:51:05 -0800, <jl********@mss ystems.com> wrote:
I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail


You may not want to use Right() if your field has 'irregular' data like
your first one above. You should use the Mid() function. Does your third
data segment always begin at the 13th position ... or is the best you can
say that it is always after the second semi-colon?

Before you answer that, ask yourself, is there any way to NOT put this
data in the same field to begin with? It looks like it should be in three
separate fields. Second, is there any way to eliminate irregular data,
which would certainly make it easier to extract.
Darryl Kerkeslager

Nov 13 '05 #3

jliccia...@mssy stems.com wrote:
I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail

Please help


Hope this doesn't have to be fast... I could do it with strReverse and
then snip off the first semi-colon and then take everything between
position 1 and the next semi-colon, but that was way too much of a
headache. Will this work for ya?

Option Compare Database

Public Function LastChunkOfStri ng(ByVal strText As String, ByVal
strDelim As String) As Variant
'Sample inputs and outputs... note, these are TEXT.
' 13981;38355;563 550;
'returns: 563550
' 13767;38355;520 270-1;
'returns: 520270-1
' 44795;38355;110 818;
'returns: 110818

Dim ChunkString As Variant
ChunkString = Split(strText, strDelim, , vbTextCompare)
LastChunkOfStri ng = ChunkString(UBo und(ChunkString ) - 1)

End Function
so I _guess_ you could do it in SQL...

SELECT... ChunkString(UBo und(Split(strTe xt, strDelim, , vbTextCompare))
- 1)
FROM...
WHERE...

but I didn't mess with that... that's the fun you get to have!

BTW, I agree with Darryl - the best way out of this mess in the future
is to not get yourself into it in the first place. Break up your data
as small as you can BEFORE you enter it, and you won't have to do these
things to begin with.

Nov 13 '05 #4

jliccia...@mssy stems.com wrote:
I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail

Please help


Hope this doesn't have to be fast... I could do it with strReverse and
then snip off the first semi-colon and then take everything between
position 1 and the next semi-colon, but that was way too much of a
headache. Will this work for ya?

Option Compare Database

Public Function LastChunkOfStri ng(ByVal strText As String, ByVal
strDelim As String) As Variant
'Sample inputs and outputs... note, these are TEXT.
' 13981;38355;563 550;
'returns: 563550
' 13767;38355;520 270-1;
'returns: 520270-1
' 44795;38355;110 818;
'returns: 110818

Dim ChunkString As Variant
ChunkString = Split(strText, strDelim, , vbTextCompare)
LastChunkOfStri ng = ChunkString(UBo und(ChunkString ) - 1)

End Function
so I _guess_ you could do it in SQL...

SELECT... ChunkString(UBo und(Split(strTe xt, strDelim, , vbTextCompare))
- 1)
FROM...
WHERE...

but I didn't mess with that... that's the fun you get to have!

BTW, I agree with Darryl - the best way out of this mess in the future
is to not get yourself into it in the first place. Break up your data
as small as you can BEFORE you enter it, and you won't have to do these
things to begin with.

Nov 13 '05 #5
The third data segment doesn't always start at the 13th position,
sometimes there are more than 3 segments. The data is system generated.
There is no way to eliminate the irregular data.
thanks
Your function LastofChunk works fine. Thanks
pi********@hotm ail.com wrote:
jliccia...@mssy stems.com wrote:
I have a table with a field that has ( a sample )
13767;38355;520 270-1;
44795;38355;110 818;
13981;38355;563 550;

as data. I need to extract the last set of numbers in each row.
I have tried right$([name],len([name])- instr(1,[name],";")-1)
but to no avail

Please help
Hope this doesn't have to be fast... I could do it with strReverse

and then snip off the first semi-colon and then take everything between
position 1 and the next semi-colon, but that was way too much of a
headache. Will this work for ya?

Option Compare Database

Public Function LastChunkOfStri ng(ByVal strText As String, ByVal
strDelim As String) As Variant
'Sample inputs and outputs... note, these are TEXT.
' 13981;38355;563 550;
'returns: 563550
' 13767;38355;520 270-1;
'returns: 520270-1
' 44795;38355;110 818;
'returns: 110818

Dim ChunkString As Variant
ChunkString = Split(strText, strDelim, , vbTextCompare)
LastChunkOfStri ng = ChunkString(UBo und(ChunkString ) - 1)

End Function
so I _guess_ you could do it in SQL...

SELECT... ChunkString(UBo und(Split(strTe xt, strDelim, , vbTextCompare)) - 1)
FROM...
WHERE...

but I didn't mess with that... that's the fun you get to have!

BTW, I agree with Darryl - the best way out of this mess in the future is to not get yourself into it in the first place. Break up your data as small as you can BEFORE you enter it, and you won't have to do these things to begin with.


Nov 13 '05 #6

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

Similar topics

19
2466
by: Peter A. Schott | last post by:
I've got a file that seems to come across more like a dictionary from what I can tell. Something like the following format: ###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10 ###,1,val_1,2,val_2,3,val_3,5,val_5,11,val_11,25,val_25,967,val_967 In other words, different layouts (defined mostly by what is in val_1, val_2, val_3). The ,#, fields indicate what "field" from our mainframe the corresponding value
6
6104
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'>
11
3612
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a million lines. b) I need to store the contents into a unique hash. c) I need to then sort the data on a specific field. d) I need to pull out certain fields and report them to the user.
8
4615
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table like so... Table 1 Field1 Field2 Field3 E1 April 2006 AA, BB, CC E2 April 2006 AA, BB, CC,DD, EE E3 April 2006 AA, BB
9
5735
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
6
3520
by: Richard | last post by:
Which way would you guys recommened to best parse a multiline file which contains two fields seperated by a tab. In this case its the linux/proc/filesystems file a sample of which I have included below: nodev usbfs ext3 nodev fuse vfat ntfs nodev binfmt_misc
29
2903
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
10
10608
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
1
1949
by: Will | last post by:
Hi, This is might be a basic question, but is it possible to hold multiple pieces of data in one field? I am adpating a database which compares multiple projects against a number of criteria. One of these is the business function that the project is sponsored by. I can set up a form to allow users to specify which of the range of
0
8917
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
8761
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
9281
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
9200
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
9142
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
8148
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
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
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
3
2163
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.