Hi

why not use a lookup table like this, then you can have any number of 
arguments

Lookup MyLut val1 yes val2 yes val3 yes "" no

in the test factory your test clause would look like this

TEST @Lookup(MyLut, &attr) == yes

if you have the lookup table in a file just INCLUDE it using the syntax 
described by Mark

if you just have the values like this

val1
val2
val3

in you file you can convert it to a lookup table using a bit of tcl ( NOTE 
is has to be on one line )

INCLUDE [puts "Lookup MyLut [join [split [string trim [read [set f [open 
"C:/temp/lut.txt"]]]][close $f] \n] " yes "] yes \"\" no "
]

I dont know if you can implement this in WB, the problem is to know the name 
of the Lookup table, and if you use a Lookup table I think it has to exists 
at WB creation time.

A workaround could be to use a attribute setter to create a new attribute 
and then set the value to @Lookup(MyLut, &Myattr) and then do the test on 
this attribute


I use this a lot in some of my projects, what i do is

I have a dBase table or a csv file with all the values and one ore more kye 
values
I then parse a macro to the mapping file with the key vlaue
I now use then INCLUDE [.. tclscript .. ] to scan the databse for matches of 
key lutValue and then write the resulting Lookup table to the mapping file 
with puts "Lookup ..."

Peter Laulund
National Survey and cadastre, Denmark


>From: "Mark Ireland" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: <[email protected]>
>Subject: RE: [fme] Dynamic Attribute Filtering
>Date: Fri, 21 Jan 2005 15:36:11 -0800
>
>
>Hi JM,
>Well the separate file idea works as long as you aren't worried about
>the format of that file; as I said edit the workspace header by adding
>an INCLUDE <filename> statement and then in the file put the Macro
>definitions.
>So instead of...
>
>value1
>
>use...
>
>MACRO mymacro1 value1
>
>So that changing the definitions in the file will alter how the
>attributeFilter operates in the workspace.
>
>As to a variable number of values - I think you're asking too much here.
>The most I can suggest is to create 10 values (for example) and if you
>use only 6 of them set the other 4 macros to -9999 or some other value
>that you know isn't going to occur in your data.
>
>For TCL I think you'd have to use it as a sort of ValueMapper - ie
>compare the attribute to one in a file and assign a new attribute on
>that basis (say a number from 1-10) - set up a permanent attributeFilter
>using these values and you'll have pretty much the same effect - still
>wouldn't use a variable number of values though.
>
>Regards,
>
>Mark
>
>Mark Ireland, Product Support Engineer
>Safe Software Inc. Surrey, BC, CANADA
>[EMAIL PROTECTED] http://www.safe.com
>Solutions for Spatial Data Translation, Distribution and Access
>
>
> > -----Original Message-----
> > From: Jean-Martin Verreault [mailto:[EMAIL PROTECTED]
> > Sent: January 20, 2005 9:06 PM
> > To: [email protected]
> > Subject: RE: [fme] Dynamic Attribute Filtering
> >
> >
> >
> > Hello Mark,
> >
> > This is cool stuff. I appreciate your input.
> > However this solution fills the job partially.
> >
> > With your proposed solution, you need to know before hand the
> > amount of filtervalues which will be used by the
> > attributefilter thus the amount of macros to write.
> > What I would like is for example say a separate file which
> > would include a set of filter values to be used by the
> > attributefilter, i.e:
> > Value1
> > Value2
> > Value3
> > <eof>
> >
> > So is it possible to "pass"/make use of these values in the
> > AttributeFilter at run time?
> > Is TCL the next level of customization to go with?
> >
> > Thanks,
> > JM
> >
> >
> >
> >
> > -----Original Message-----
> > From: Mark Ireland [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, January 19, 2005 4:39 PM
> > To: [email protected]
> > Subject: RE: [fme] Dynamic Attribute Filtering
> >
> > Hi JM,
> > This is advanced stuff, but yes this is possible to do
> > dynamically by setting macros within the AttributeFilter.
> >
> > I've attached a small workspace and dataset that will show you how.
> >
> > I created a Macro in the workspace header which results in a
> > new setting available in the navigator window under the CSV
> > dataset. It is flagged 'always prompt' so you will be
> > prompted for a value whenever you choose run workspace (but
> > not rerun workspace, so make sure you choose
> > file->run).
> >
> > That macro is placed in the attributefilter as a value. When
> > you run the workspace set the value to 151 - you will see 7
> > points have an ID of 151 etc
> >
> > You could get the macro values through a GUI (as I have done)
> > or pass them from the command line. However, in your case you
> > may want to read the values from a file rather than create
> > header macros.
> > If that were the case I suggest you set up a file which you
> > point to with an include in the workspace header.
> >
> > ie Tools->Edit Header
> > Add the line... INCLUDE myparams.fmi
> >
> > And in the file myparams.fmi have...
> >
> > MACRO mymacro1 <<value1>>
> > MACRO mymacro2 <<value2>>
> >
> > ...where mymacro is the name of macro you are going to use in
> > the AttributeFilter and <<value>> is the value you wish to
> > filter against.
> >
> > If you do this then you can set up your workspace and
> > AttributeFilter and run it whenever you like without changing
> > anything. Edit the values in myparams.fmi when required and
> > Workbench will filter against these instead.
> >
> > The other advantage is that when you use the 'Import'
> > function in AttributeFilter it will add values, and not
> > replace them, so you would also have to manually edit your
> > connections using that method.
> >
> > Hope this helps. These techniques are very useful for setting
> > up user defined settings and having them used within
> > Workbench transformers.
> > They aren't always compatible, and sometimes you need to use
> > [] brackets instead of () - but I think this is a
> > much-underused function.
> >
> > BTW, Whatever you do don't right-click an AttributeFilter
> > output port and choose 'route to visualiser' when the value
> > is a macro name - when you do that the Visualiser name
> > includes the macro name and things start to fall apart! I'd
> > also be careful to ensure you pass a value to every macro
> > listed in the filter, because without there may be problems.
> >
> > Regards,
> >
> > Mark
> >
> > Mark Ireland, Product Support Engineer
> > Safe Software Inc. Surrey, BC, CANADA
> > [EMAIL PROTECTED] http://www.safe.com
> > Solutions for Spatial Data Translation, Distribution and Access
> >
> >
> > > -----Original Message-----
> > > From: spatial_it_2k [mailto:[EMAIL PROTECTED]
> > > Sent: January 18, 2005 8:39 AM
> > > To: [email protected]
> > > Subject: [fme] Dynamic Attribute Filtering
> > >
> > >
> > >
> > >
> > > Hello group,
> > >
> > > Does anyone know how it is possible to dynamically specify an
> > > AttibuteFilter? In other words, I would like to run a
> > workspace where
> > > the data which is to be converted filters the data on a predefined
> > > attribute using runtime attribute values for the filter.
> > >
> > > Is it possible to use a file with a list of attibute values for the
> > > filter and then use this file one way or another to filter the data
> > > based on those values.
> > >
> > > Any ideas?
> > >
> > > JM
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Get the maximum benefit from your FME, FME Objects, or
> > SpatialDirect
> > > via our Professional Services team.  Visit
> > www.safe.com/services for
> > > details.
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > Get the maximum benefit from your FME, FME Objects, or
> > SpatialDirect via our Professional Services team.  Visit
> > www.safe.com/services for details.
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Get the maximum benefit from your FME, FME Objects, or
> > SpatialDirect via our Professional Services team.  Visit
> > www.safe.com/services for details.
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>Get the maximum benefit from your FME, FME Objects, or SpatialDirect via 
>our Professional Services team.  Visit www.safe.com/services for details.
>Yahoo! Groups Links
>
>
>
>
>
>
>

_________________________________________________________________
Log p� MSN Messenger direkte p� nettet  http://webmessenger.msn.com/






Get the maximum benefit from your FME, FME Objects, or SpatialDirect via our 
Professional Services team.  Visit www.safe.com/services for details. 
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