Hi Gunter

its not exacly clear what you want, but the below tcl function returns what 
I think you want

the idear are
1. create a list of attributes and a list of legal vlaues
2. use a loop to test if the value of a given attribute are 'legal'
3. if it is we append it to the return value
4. last we combine the elements in the retval varaible with a ',' and 
returns the vlaue to fme

To call this function from a workespace use the Tcl caller transformer

In a mapping file just put it in as
@SupplyAttributes(my_attr_lst, @Tcl2(testAttr))



proc testAttr {} {

     set retval [list ]
     set attrLst {attr1 attr2 attr3}
     set valLst  {value1 value3}

     foreach attr $attrLst {
         if {[FME_AttributeExists $attr]} {
             if {[ lsearch $valLst [FME_GetAttribute $a ]] >= 0 } {
                 lappend retval $attr
             }
         }
     }
     return [join $retval \,]
}



Peter Laulund




>From: "gunter_nt" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [fme] Re: Combine attributes and values into a string
>Date: Tue, 01 Aug 2006 23:52:47 -0000
>
>--- In [email protected], Hans van der Maarel <[EMAIL PROTECTED]> wrote:
> >
> > Hello Gunter,
> >
> > > Is there an easy way to take a list of attributes on one feature
>and
> > > their corresponding values and combine it into a string?
> > > For example a feature has:
> > > attr1 'value1'
> > > attr2 'value2'
> > > attr3 'value3'
> > > and I want his to turn this into a string useable in a where
>clause
> > > something like:
> > > whereClause: 'ATTRIBUTE_NAME IN (attr1,attr3)'
> > >
> > > ignoring attributes whos value = 'value2'.
> >
> > Well, if it's just for selecting, you can actually do that in a
>Tester
> > (http://fmepedia.com/index.php/Tester) by entering multiple
>criteria.
> >
> > Combining strings can be done with the Concatenator
> > (http://fmepedia.com/index.php/Concatenator)
> >
> > --
>
>Hi Hans,
>Thanks for that but I was actually after concatenating the
>attribute 'name' rather than the attribute 'value'. I am not aware
>how this can be done with the concatenator.
>also, I only wanted to concatenate the attributes name if the
>attribute value equalled a certain value.
>The end result of a tester is a pass/fail on the whole object, where
>what I am after is the object to continue through, but only keep the
>attributes whose values pass.
>
>I might just try a different approach to the problem.
>
>Thanks
>Gunter
>
>
>
>
>
>
>
>
>
>Join us at the FME Worldwide User Conference Sept. 21-22, 2006 Vancouver BC 
>Canada. For more information, visit www.safe.com/2006uc.
>Yahoo! Groups Links
>
>
>
>
>
>
>

_________________________________________________________________
Ta' på udsalg året rundt på MSN Shopping:  http://shopping.msn.dk  her 
finder du altid de bedste priser





Join us at the FME Worldwide User Conference Sept. 21-22, 2006 Vancouver BC 
Canada. For more information, visit www.safe.com/2006uc.   
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/fme/

<*> 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/
 



Reply via email to