Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
List Processing - How to Remove Empty Elements
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Wilkinson  
View profile  
 More options Nov 21 2008, 10:06 am
From: "Richard Wilkinson" <RWilkin...@leics.gov.uk>
Date: Fri, 21 Nov 2008 15:06:45 -0000
Local: Fri, Nov 21 2008 10:06 am
Subject: List Processing - How to Remove Empty Elements

Hi,

While doing some processing I find that I have a list, 8 elements, some
of which are empty. The final operation would be to concatenate all the
elements into a single feature with coma separation (use
listconcatenator).  There might also be duplicates that can be removed
with ListDuplicateRemover.

Does anyone know an easy way to remove the empty elements from a list
before I do the concatenation?

Thanks

Richard Wilkinson
Systems Analyst
Resources - ICT Services
Leicestershire County Council
0116 3057709  
rwilkin...@leics.gov.uk

___________________________________________________________________________
Leicestershire County Council - rated a  'four-star' council by the Audit Commission
___________________________________________________________________________
This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received.
Incoming and outgoing e-mail messages are routinely monitored for compliance with Leicestershire County Council's policy on the use of electronic communications.   The contents of e-mails may have to be disclosed to a request under the Data Protection Act 1998 and the Freedom of Information Act 2000.
The views expressed by the author may not necessarily reflect the views or policies of the Leicestershire County Council.
Attachments to e-mail messages may contain viruses that may damage your system. Whilst Leicestershire County Council has taken every reasonable precaution to minimise this risk, we cannot accept any liability for any damage which you sustain as a result of these factors. You are advised to carry out your own virus checks before opening any attachment.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hans van der Maarel  
View profile  
 More options Nov 21 2008, 10:31 am
From: Hans van der Maarel <h...@redgeographics.com>
Date: Fri, 21 Nov 2008 16:31:33 +0100
Local: Fri, Nov 21 2008 10:31 am
Subject: Re: [fme] List Processing - How to Remove Empty Elements

Richard Wilkinson wrote:
> While doing some processing I find that I have a list, 8 elements, some
> of which are empty. The final operation would be to concatenate all the
> elements into a single feature with coma separation (use
> listconcatenator).  There might also be duplicates that can be removed
> with ListDuplicateRemover.

> Does anyone know an easy way to remove the empty elements from a list
> before I do the concatenation?

To be honest, I'd try taking it out of the concatenated attribute using
a StringReplacer. Replace ",," with "," would probabely do the trick...
--
Hans van der Maarel
Red Geographics

Zevenbergsepoort 44b            www.redgeographics.com
4791 AE  Klundert               h...@redgeographics.com
The Netherlands                 phone: +31-168-401035
                                skype: redgeographics


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Wilkinson  
View profile  
 More options Nov 21 2008, 10:51 am
From: "Richard Wilkinson" <RWilkin...@leics.gov.uk>
Date: Fri, 21 Nov 2008 15:51:44 -0000
Local: Fri, Nov 21 2008 10:51 am
Subject: RE: [fme] Re: List Processing - How to Remove Empty Elements
Hi Hans,

That was one of my thoughts but as there could be several empty elements
posible two/three together I would have to run the stringreplacer
several times.

Simple case = A, , C, D, E, , G, H
Other case  =  , , , D, E, , G,
Or          = A, , C, , , , G, H

On second thoughts maybe this could work.  Attributetrimmer (both)
removes left & right comma.  String replacer twice.

I'll have another go.

Have a nice weekend.

Richard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hans van der Maarel  
View profile  
 More options Nov 21 2008, 10:59 am
From: Hans van der Maarel <h...@redgeographics.com>
Date: Fri, 21 Nov 2008 16:59:07 +0100
Local: Fri, Nov 21 2008 10:59 am
Subject: Re: [fme] Re: List Processing - How to Remove Empty Elements

Richard Wilkinson wrote:
> That was one of my thoughts but as there could be several empty elements
> posible two/three together I would have to run the stringreplacer
> several times.

> Simple case = A, , C, D, E, , G, H
> Other case  =  , , , D, E, , G,
> Or          = A, , C, , , , G, H

> On second thoughts maybe this could work.  Attributetrimmer (both)
> removes left & right comma.  String replacer twice.

> I'll have another go.

Try [ ,] as a regular expression.
--
Hans van der Maarel
Red Geographics

Zevenbergsepoort 44b            www.redgeographics.com
4791 AE  Klundert               h...@redgeographics.com
The Netherlands                 phone: +31-168-401035
                                skype: redgeographics


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
peter laulund  
View profile  
 More options Nov 21 2008, 4:24 pm
From: peter laulund <peter_laul...@hotmail.com>
Date: Fri, 21 Nov 2008 21:24:20 +0000
Local: Fri, Nov 21 2008 4:24 pm
Subject: RE: [fme] Re: List Processing - How to Remove Empty Elements

Hi Richard

a bit of tcl will do the trick, somthing like this

proc concatList {listName attr} {

       set resLst [list]
       set n [ FME_Execute NumElements $listName ]
       for { set i 0} { i < $n } { incr i } {
            set s [ FME_GetAttribute $listName{$i} ]
            if { $s ne "" } {
                 lappend resLst $s
            }
       }
       FME_SetAttribute $attr [join $resLst ,]

}

the idear is
1. get the number of ellmenst in the list
2. loop trough the list and get the value
3. if the value is different from "" add it to the result tcl list
4. create the new attribute and join the lsit with ',' and add it to the new attribute

have a nice weekend
peter

_________________________________________________________________
Pimp dig selv i Messenger!
http://www.messengerplayground.dk/buddymaker


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Wilkinson  
View profile  
 More options Nov 24 2008, 4:05 am
From: "Richard Wilkinson" <RWilkin...@leics.gov.uk>
Date: Mon, 24 Nov 2008 09:05:17 -0000
Local: Mon, Nov 24 2008 4:05 am
Subject: RE: [fme] Re: List Processing - How to Remove Empty Elements

Peter,

Thanks.  I thougfh this would be doable with tcl but as yet my tcl is
not quite up to it.  I'll give this a try.

Richard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SigTill  
View profile  
 More options May 4 2012, 4:36 am
From: SigTill <shers...@gmail.com>
Date: Fri, 4 May 2012 01:36:38 -0700 (PDT)
Local: Fri, May 4 2012 4:36 am
Subject: Re: [fme] Re: List Processing - How to Remove Empty Elements

Hm, I tried this. But not having used TCL there seems to be a problem. I
have replaced the names to my correct table names and added the following
to TCLCaller-parameters:
Destination Attribute: resLst
Attributes to Expose: listName{}

I can see the resLst in the Inspector, but it does not have any values. Am
I missing some curlybrackets on for instance resLst? (resLst{0}?) or do I
have to Expose for instance listName{}.Name and listName{}.Address for them
to be available?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Ireland  
View profile  
 More options May 4 2012, 12:04 pm
From: Mark Ireland <mark.irel...@safe.com>
Date: Fri, 4 May 2012 09:04:27 -0700 (PDT)
Local: Fri, May 4 2012 12:04 pm
Subject: Re: List Processing - How to Remove Empty Elements
OK, there is another way in 2013. It will sound odd and I am going to
file an enhancement request for reasons you'll see in a moment.

In 2013, we added an option to the AttributeSplitter to ignore empty
values.
So, if you can use 2013 you could:

- use ListConcatenator to get a comma separated attribute
- use AttributeSplitter to turn it back into a list, without the empty
fields
- use ListConcatenator again to get the final comma separated
attribute

Obviously we should also add the ignore null option to the
ListConcatenator. That's what I will file the PR for.
But I think the above should work fine just now.

Regards

Mark

Mark Ireland | Senior Product Specialist
Safe Software Inc.
Suite 2017, 7445-132nd Street, Surrey, BC, CANADA
T 604.501.9985 | F 604.501.9965
http://www.safe.com/support | Twitter @FMEDoctors | http://www.fmepedia.com

On May 4, 1:36 am, SigTill <shers...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SigTill  
View profile  
 More options May 7 2012, 4:35 am
From: SigTill <shers...@gmail.com>
Date: Mon, 7 May 2012 01:35:27 -0700 (PDT)
Local: Mon, May 7 2012 4:35 am
Subject: Re: List Processing - How to Remove Empty Elements

Hm, unfortunately we have to run FME Server 2012, so doing this in 2013 is
not possible. I will try to find another workaround. Nor sure why the
TCL-does not work though, have to read up on it to better understand it I
guess.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeroen Muris  
View profile  
 More options May 8 2012, 3:05 am
From: Jeroen Muris <j.mu...@schiedam.nl>
Date: Tue, 8 May 2012 00:05:22 -0700 (PDT)
Local: Tues, May 8 2012 3:05 am
Subject: Re: List Processing - How to Remove Empty Elements

Did you try it with StringReplacer and AttributeTrimmer, using ,,*
(comma,comma,asterisk) or ,+ (comma,plus) as regex in the StringReplacer?
Both seem to cleanup the concatenated value for me, even with multiple
consecutive commas.

J-----.

Op maandag 7 mei 2012 10:35:27 UTC+2 schreef SigTill het volgende:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Ireland  
View profile  
 More options May 11 2012, 3:00 pm
From: Mark Ireland <mark.irel...@safe.com>
Date: Fri, 11 May 2012 12:00:08 -0700 (PDT)
Local: Fri, May 11 2012 3:00 pm
Subject: Re: List Processing - How to Remove Empty Elements
Hi all
Just following up to let you know that the 2013 ListConcatenator now
has an option to ignore empty fields.
It will be in FME beta builds 13100 or greater.

I know it doesn't help in this case, if you can't upgrade to 2013, but
I just wanted to let you know it will be there when you can eventually
upgrade to 2013

Regards

Mark

Mark Ireland | Senior Product Specialist
Safe Software Inc.
Suite 2017, 7445-132nd Street, Surrey, BC, CANADA
T 604.501.9985 | F 604.501.9965
http://www.safe.com/support | Twitter @FMEDoctors | http://www.fmepedia.com

On May 8, 12:05 am, Jeroen Muris <j.mu...@schiedam.nl> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
SigTill  
View profile  
 More options May 13 2012, 1:21 pm
From: SigTill <shers...@gmail.com>
Date: Sun, 13 May 2012 10:21:05 -0700 (PDT)
Local: Sun, May 13 2012 1:21 pm
Subject: Re: List Processing - How to Remove Empty Elements

Thanks for a swift reply and fix as always!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »