Hi

Your problem is that your a mixing things the macros and INCLUDE is 
evaluated when the mapping file are parsed and not when it processing data, 
for this you have to use th TCL/Tcl2 syntax. Also note you can't us a macro 
the way you try to do, the best way i to use a retun value and the place it 
in the attribute you want.

Somthing like this

Tcl2 myProg {} {  set val [FME_GetAttribute autocad_resolved_linetype] ;
    if {[string equal $val "DASHED2"} {
        return 120
    } else { .....

and then i your testfactory
   ....
   OUTPUT PASSED FEATURE_TYPE TESTER_linetype_PASSED           \
      @SupplyAttributes(mapinfo_pen_pattern, @Tcl2(myProg)            \
  ....

Note: In your case i would not use a tcl function but a @Lookup function and 
table

like this

Lookup mytab DASHED2 120 val2 25 "" 2

and then in the testfactory
      @SupplyAttributes(mapinfo_pen_pattern, @Lookup(myTab, 
autocad_resolved_linetyp)            \


The INCLUDE [some tcl ..]  is an extremy usefull command for creating 
dynamic mapping files, writing macros or factorys into the mapping file if a 
macro has a given value

In the exampel below the TeeFactory is written to the mapping file if the 
Format macro is different from SHAEP

INCLUDE [if { "$(Format)" != "SHAPE" } {                                     
  \
         puts {FACTORY_DEF * TeeFactory                                  \ 
}; \
         puts {  FACTORY_NAME "LDS EXPORT: Tilpas output"                \ 
}; \
         puts {  INPUT  FEATURE_TYPE *                                   \ 
}; \
         puts {  OUTPUT FEATURE_TYPE *                                   \ 
}; \
         puts {     @FeatureType(&FinalFeature)                          \ 
}; \
         puts {     @Transform(FME_GENERIC, $(Format))                   \ 
}; \
         puts {     @Log("Output logger", 10, 1)                          
}}]

or in this exampel if the SourceCoordSys is differetn from the DestCoordSys 
we include a mapping file modul into the mapping file

INCLUDE [if { "$(SourceCoordSys)" != "$(DestCoordSys)" } {                   
  \
                  puts {INCLUDE "$(FME_HOME)KMS\KMSTRANS.FMI"}}]

This way it is possible to create a dynamic mapping file there is a function 
of one ore more macroes. I have a system where I have one mapping file 
reading tre differet datasets - from 2 oracle databases - and exporting them 
into 10 differet output formates. The main mapping file is onle based on the 
INCLUD [...   syntax

Peter laulund
National Survey and Cadastre Denmark

>From: KaGi <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: [fme] TCL
>Date: Fri, 25 Feb 2005 10:19:42 -0500 (EST)
>
>
>Hi all,
>
>I try to use TCL but it doesn't work with me :(
>
>I want to test the value of autocad_resolved_linetype and creating a new 
>Macro to keep the value in it...
>
>I try both MACRO and DEFAULT_MACRO and I always get the same error while 
>executing  "INCLUDE -- failed to evaluate TCL expression `..."
>
>If someone could help me with that
>
>Thanks
>
>
>
># -------------------------------------------------------------------
>FACTORY_DEF * TestFactory                                      \
>    FACTORY_NAME TESTER_linetype                                \
>    INPUT  FEATURE_TYPE ATTRIBUTECREATOR_pen_pattern_OUTPUT     \
>    TEST &autocad_resolved_linetype != CONTINUOUS               \
>    BOOLEAN_OPERATOR OR                                         \
>    OUTPUT PASSED FEATURE_TYPE TESTER_linetype_PASSED           \
>    OUTPUT FAILED FEATURE_TYPE TESTER_linetype_FAILED
>
>
>#*********************  MY CODE **************************************
>INCLUDE [                                                         \
>   if {$FME_Attributes(autocad_resolved_linetype) == "DASHED2"}    \
>        {puts "MACRO PATTERNVALUE 7";   }                  \
>   elseif {$FME_Attributes(autocad_resolved_linetype) == "CENTER"} \
>        {puts "MACRO PATTERNVALUE 120"; }                          \
>   else   {puts "MACRO PATTERNVALUE 2"; }                          \
>   ]
>
>
>#*******************************************************************
>
>FACTORY_DEF * TeeFactory                                           \
>    FACTORY_NAME ATTRIBUTESETTER_MAPINFO_DASHED2                    \
>    INPUT  FEATURE_TYPE TESTER_linetype_PASSED                      \
>    OUTPUT FEATURE_TYPE ATTRIBUTESETTER_MAPINFO_DASHED2_OUTPUT      \
>         @SupplyAttributes(mapinfo_pen_pattern,$(PATTERNVALUE))
>
>
>
>
>---------------------------------
>L�che-vitrine ou l�che-�cran ? Yahoo! Magasinage.

_________________________________________________________________
Find masser af gode tilbud p� MSN Shopping http://shopping.msn.dk/






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