473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Concatenate Field, Count Characters and Shorten Value

Hi, I have a table with non-unique identifiers. I need to take all
the values with the same ID's and combine them into one field with a
semicolon as a seperator. These values may exceed 255 characters. I
then need to count the values in the cell and see if it adds up to 240
or more and then shorten that field by cutting off the excess and
adding only "...and other". So, to recap, I need to summarise values
based on the ID field, count the characters and then cut the field off
and add the text.

I was thinking I could summarize the table somehow, then use a update
query or script to add a character count to a new field in the table
and then shorten those to 240 characters. Then update the field by
adding the text. This all said, I have absolutely no idea how to do
this! Please help.

Dean

Oct 8 '07 #1
5 8925
Dean wrote:
Hi, I have a table with non-unique identifiers. I need to take all
the values with the same ID's and combine them into one field with a
semicolon as a seperator. These values may exceed 255 characters. I
then need to count the values in the cell and see if it adds up to 240
or more and then shorten that field by cutting off the excess and
adding only "...and other". So, to recap, I need to summarise values
based on the ID field, count the characters and then cut the field off
and add the text.

I was thinking I could summarize the table somehow, then use a update
query or script to add a character count to a new field in the table
and then shorten those to 240 characters. Then update the field by
adding the text. This all said, I have absolutely no idea how to do
this! Please help.

Dean
Have you considered a MEMO field? You can hold lots of data in a memo.
You can even display it on a form with scroll bars.

Oct 8 '07 #2
Dean <de**********@yahoo.comwrote in
news:11**********************@50g2000hsm.googlegro ups.com:
Hi, I have a table with non-unique identifiers. I need to take
all the values with the same ID's and combine them into one field
with a semicolon as a seperator. These values may exceed 255
characters. I then need to count the values in the cell and see
if it adds up to 240 or more and then shorten that field by
cutting off the excess and adding only "...and other". So, to
recap, I need to summarise values based on the ID field, count the
characters and then cut the field off and add the text.

I was thinking I could summarize the table somehow, then use a
update query or script to add a character count to a new field in
the table and then shorten those to 240 characters. Then update
the field by adding the text. This all said, I have absolutely no
idea how to do this! Please help.

Dean
Find the fConcatChild() function by Google search on this group,
That summarises the row, use the Left() function to limit to 240
characters.
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Oct 8 '07 #3
On Oct 9, 9:49 am, Salad <o...@vinegar.comwrote:
Dean wrote:
Hi, I have a table with non-unique identifiers. I need to take all
the values with the same ID's and combine them into one field with a
semicolon as a seperator. These values may exceed 255 characters. I
then need to count the values in the cell and see if it adds up to 240
or more and then shorten that field by cutting off the excess and
adding only "...and other". So, to recap, I need to summarise values
based on the ID field, count the characters and then cut the field off
and add the text.
I was thinking I could summarize the table somehow, then use a update
query or script to add a character count to a new field in the table
and then shorten those to 240 characters. Then update the field by
adding the text. This all said, I have absolutely no idea how to do
this! Please help.
Dean

Have you considered a MEMO field? You can hold lots of data in a memo.
You can even display it on a form with scroll bars.- Hide quoted text -

- Show quoted text -
Hi ...Salad.

Yes, I'm aware of the memo field type, but the thing is that it needs
to go back into software, which doesn't support memo fields. The
largest it can go there is 255 in a text field. It's quite a bugger,
otherwise it would've been a lot easier I guess.

Cheers anyway mate.

Dean

Oct 9 '07 #4
Hi Bob,

Right, first of all, I can't find any reference to fConcatChild under
Access Help. Do I need to add this from a library? I got the posts
on this site though, but it seems to all over the place and not really
the answer I need. Also, I need to identify the cells with more than
240 characters, so I can add the text "...and other" to the end of
it. Is there a way to count characters?

If I have a field named PARCEL_ID in a table named OWNERS_JOINED, then
how do I concatenate the OWNER_NAME field based on the PARCEL_ID
field?

Cheers mate

Dean

Oct 9 '07 #5
On Oct 8, 10:39 pm, Dean <deancarst...@yahoo.comwrote:
Hi Bob,

Right, first of all, I can't find any reference to fConcatChild under
Access Help. Do I need to add this from a library? I got the posts
on this site though, but it seems to all over the place and not really
the answer I need. Also, I need to identify the cells with more than
240 characters, so I can add the text "...and other" to the end of
it. Is there a way to count characters?
You will not find any reference to it in access, it's a user-defined
function written by Dev Ashish that you will need to paste into a
code
module as described on the web page where it lives.
http://www.mvps.org/access/modules/mdl0004.htm

To count characters, you just use the len() function. To cut the
string
to 240 characters use the left function.

I suggest that first you will need to create a temporary table, with
the Parcel_ID and a memo type field to hold the whole string, then
use
the temp table to trim to length and add the "...and other" to the
long
strings, then move the results to their new home.

If I have a field named PARCEL_ID in a table named OWNERS_JOINED, then
how do I concatenate the OWNER_NAME field based on the PARCEL_ID
field?

Cheers mate

Dean
The following queries will do that

INSERT into Temp1 (PARCEL_ID,OWNERS_JOINED)
SELECT DISTINCT PARCEL_ID, fConcatChild("OWNERS_JOINED",
"PARCEL_ID","OWNER_NAME","STRING",[PARCEL_ID]) FROM OWNERS_JOINED

INSERT into NewTable1 (PARCEL_ID,OWNERS_JOINED)
SELECT PARCEL_ID, IIF( LEN(OWNERS_JOINED)>240,LEFT(OWNERS_JOINED,240)
&
"...and more",OWNERS_JOINED) FROM temp1
Oct 9 '07 #6

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

Similar topics

2
by: ImraneA | last post by:
Hi there Got a interesting problem (depends on a point of view.....). Background :- Agent (within Domino) is run daily basis which extracts data from Domino Notes application to SQL Server...
1
by: SAN CAZIANO | last post by:
how can i create a runtime table and define a new field to allow null value and set the rquired to true or false ???
1
by: Hicham G. Elmongui | last post by:
what does this message mean? thanks, --h
2
by: Young | last post by:
How do I set a field to a null value in the UPDATE statement? Eg. To update a text UPDATE SET = 'X' But if I want to set it to null, what is the syntax? TIA
6
by: Jay | last post by:
I need to convert from a string a double that is followed by a scaling character (k means *1e3, M=*1e6, etc) then apply the scaling character. Example: "-1.345k #comment" I know roughly how...
1
by: tejineha | last post by:
i want to knw if any particular exception exists that is to be written in catch block when a field gets a same value for the field that is defined as primary key..as primary key cnot have same...
4
by: nedryerson | last post by:
Hi, I'm trying to get a certain field to appear only when a value from another combobox field is selected. Specifically, when "Sample Rejected" is selected in the field "PcrLabResults," I would...
1
by: fuadmab | last post by:
if field a equels value then field b equels another value, how can i construct the code in V.B , i tried but did not work thanks
19
by: jaad | last post by:
how do you reference a single value field to a multi-value field? I sometime use a macro in form1 to open form 2 containing the same ID example: Open form: WorkOrder where condition: ="="...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.