473,770 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading comma seperated lists

Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT

At the moment, I've got the VBA bits working on the single
ID stuff, but, should it come across a list like the above,
I want it to parse both entries as two different entities.

How would I go about getting it to do this?

Hope that makes sense,

:-)

Gary
Nov 13 '05 #1
3 1655
On 2004-09-05, Gary Smith <sh******@l33 t-d00d.co.uk> wrote:
Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT


Hmm, that was a really bad explanation of what I wanted to do. Sorry.

Let me clarify.

I've got a few tables, one of which is imported data. In this table,
is one field containing a list of rooms - usually, this contains a single
room. However, there's a few instances where this will contain two,
in the above form (ie "BENL LT, RAT LT"). There's a Form that goes
through this imported data and does Stuff[tm] to it with a script.

One of these things is it cross references these rooms against another
table in the database. However, when it comes across these rooms (ie a
comma seperated list, it doesn't recognise it, although the two on their
own are valid. How can I get the script to recognise these are two
distinct entities, rather than one?

Cheers,

Gary, hoping that makes more sense.
Nov 13 '05 #2
rkc

"Gary Smith" <sh******@l33 t-d00d.co.uk> wrote in message
news:sl******** *************@p rofile.l33t-d00d.co.uk...
On 2004-09-05, Gary Smith <sh******@l33 t-d00d.co.uk> wrote:
Hi, I've got a field that contains a list of rooms.

In most cases, this contains a single ID. However, under some
circumstances, the field may contain a list of two IDs which
are broken by a comma.

For example: BENL LT, RAT LT


Hmm, that was a really bad explanation of what I wanted to do. Sorry.

Let me clarify.

I've got a few tables, one of which is imported data. In this table,
is one field containing a list of rooms - usually, this contains a single
room. However, there's a few instances where this will contain two,
in the above form (ie "BENL LT, RAT LT"). There's a Form that goes
through this imported data and does Stuff[tm] to it with a script.

One of these things is it cross references these rooms against another
table in the database. However, when it comes across these rooms (ie a
comma seperated list, it doesn't recognise it, although the two on their
own are valid. How can I get the script to recognise these are two
distinct entities, rather than one?


Avoid the problem by splitting the records with multiple values when you
import the data.

or

Have the script check for an occurance of a comma, split the
field and process it as two records. Details of how to do that depend
greatly on the script that does the Stuff. Just splitting the field is
trivial
using Split() if you're post Access 97 or Instr() and Left(), Right(), Mid()
if your at Access 97.

Nov 13 '05 #3
On 2004-09-05, rkc <rk*@yabba.dabb a.do.rochester. rr.bomb> wrote:
Have the script check for an occurance of a comma, split the
field and process it as two records. Details of how to do that depend
greatly on the script that does the Stuff. Just splitting the field is
trivial
using Split() if you're post Access 97 or Instr() and Left(), Right(), Mid()
if your at Access 97.


I had a think about this on the train (I was away over the
weekend) and ended up doing voodoo with Left(Instr()) and Right(Instr() in the
end, and stripping out any errant spaces that might've crept in and it seems
to have done the trick.

Cheers :-)

Gary
Nov 13 '05 #4

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

Similar topics

7
3089
by: Craig Keightley | last post by:
is it possible to compare acomma separated list aginst another eg comma list 1 => 1,2,3,4,5 comma list 2 => 3,5 can you check that 3 is in both, and 5 is in both, therfore they match??? the comparison is to check that if product a who supplies products 1,2,3,4,5 can be used instead of product b who supplies 3,5 as product a already supplies them
2
2726
by: Pmb | last post by:
I'm trying to learn the syntax for initializing objects in a comma separated list. Below is an example program I wrote to learn how to do this (among other things). While I understand how to initialize a primitive data type with a comma separated list, e.g. int a = { 11, 23, 43 }; I know how to initialize the example object's "student1" and "student2" below, e.g.
3
4877
by: muzamil | last post by:
To get rid of redundant data in a table, my cleint will be providing something like this: IDtokeep Ids to delete 34 24,35,49 12 14,178,1457 54 32,65,68 I have to write a script for each of the above rows which looks like
11
2391
by: Shawn Odekirk | last post by:
Some code I have inherited contains a macro like the following: #define setState(state, newstate) \ (state >= newstate) ? \ (fprintf(stderr, "Illegal state\n"), TRUE) : \ (state = newstate, FALSE) This macro is called like this: setState(state, ST_Used);
4
12808
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0 to read text file but could not get the data in correct format. All columns are not coming in dataset and rows are messing up. Suggestions please ???
1
2477
by: CJK | last post by:
this is what i have so far: #include <iostream> #include <string> #include <vector> #include <fstream> using namespace std; class Person {
13
2177
by: anant | last post by:
Hi all The below code is reading string and then tokenizin it and reading all the info. But i want to call a csv file and it should then read a string from dt file. So what midification should i do in the below code. Its main code, all the functions are defined well. So just wanna know how to include some extra code to open the file and read each line. Thanks a lot typedef struct {
2
1654
nehashri
by: nehashri | last post by:
i hv a database in access wid Asp as front end. ven given a word in search command(of the front end) it shud go to a table in which each field has words serated by comma. each word shud b checked for the given user word n then only futher procedure shud happen. this table has 2 columns one is library(colum has only one word present) is linked to another table of the same DB and other column has this synonyms (synonym of the word in...
1
4205
by: (2b|!2b)==? | last post by:
I have the following line in my code, which is supposed to skip commas and white space and to read a comma seperated value string into the appropriate variables: sscanf(temp.c_str(), "%f%*,%d%*,%f%*,%d%*,%d%*,%f%*,%f%*,%f%*,%f%*,%d%*,%f%*,%d%*,%d", &dt, &ti, &lsp, &lst, &lsv, &o, &h, &l, &bd, &bv, &ak, &av, &cv) ; I suspect the format specifiers are incorrect, since I am not reading
0
9617
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
9454
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
10099
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
10037
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
8931
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
7456
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
6710
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
5354
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...
3
2849
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.