Hi
as mark poits out this is a case where tcl will do the job in just a few
lines off code
somthing like this, I am home now so I can not check that the syntax i
correct, but I think it should work, I use this approach a lot, in some
cases I put the mapping of the attributes in an external file, this way we
just have to change this file - and not the mapping file - when the data
changes
just use the TCLExecuter transformer? to run the function
proc dynamicRename {} { \
foreach attr [ lsearch -regexp -inline -all [FME_AttirbuteNames]
"data_feat_" ] { \
FME_RenameAttribute [lindex [split $attr _] end] $attr ; \
} ; \
}
I just love this command
set attrLst [ lsearch -regexp -inline -all [FME_AttirbuteNames]
"data_feat_" ]
basede on a regular expression it will give you all attributes on a feature
matching the expresion
when we have the list we can run trough the it with a foreach command
renaming the attributes using split and lindex to extract the last part off
the name
Peter
>From: "mark2atsafe" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [fme] Re: Automatic attribute renaming
>Date: Wed, 10 Jan 2007 19:52:22 -0000
>
>Hi Adrian,
>I can't think of a way to rename the attribute names except by TCL.
>@RenameAttributes doesn't appear to permit multiple changes - the
>AttributePrefixer help says it uses this function, but doesn't.
>
>The good news is that I think the TCL would be fairly simple. In fact,
>I'm almost tempted to suggest that the easiest way would be to grab
>the transformer definition for AttributePrefixer (from fmesuite.fmx)
>and create a new transformer, replacing the "prefix appending" part
>with a "strip off these characters" part. That way you have the
>outline of the TCL already defined, and just need to insert the
>correct replacement function.
>
>I'll maybe have a try at this if I have time... but will definitely
>look up the TCL command you would need to use.
>
>Mark
>
>Mark Ireland, Senior Product Specialist
>Safe Software Inc. Surrey, BC, CANADA
>[EMAIL PROTECTED] http://www.safe.com
>Solutions for Spatial Data Translation, Distribution and Access
>
>
>--- In [email protected], "amp_starapic" <[EMAIL PROTECTED]> wrote:
> >
> > Hi Everyone
> >
> > Happy new year to all!
> >
> > I am using workbench to create an automatic translator. The source
> > features have a number of attributes all beginning with a prefix, e.g.
> > "data_feat_". I would like to be able to automatically rename the
> > attributes by removing this prefix. I do not have a full list of the
> > attributes that have the prefix, hence the need to make it quite
>generic!
> >
> > I suspect this may involve TCL which i afraid I do not much
>experience of!
> >
> > Does any one have any suggestions?
> >
> > Many Thanks
> >
> > Adrian
> >
>
>
_________________________________________________________________
Find dine dokumenter lettere med MSN Toolbar med Windows-pc-søgning - hent
den gratis her: http://toolbar.msn.dk
For insights into what's up at Safe Software and what's on the development
horizon, visit Safe's blog at spatial-etl.blogspot.com.
Safe Software has also made slides available that outline enhancements planned
for FME 2007. The slides are from the "Road Ahead" presentation given on Day 2
of the FME Worldwide Users Conference. To view these slides, visit
www.safe.com/2006uc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/fme/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/fme/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/