Hi

It not clear from you mail, but what  I think you are looking for is some 
more advancede logging off the individual factorys

In order to document the individual translations I have written a 
'transformer' and tcl script that create a logfile with metadata about the 
actual job

I have attatched an exampel off the logfiel and the script, I shoud be 
possible to change it in a way so it document what goes on in a factory

I just include the script into my mapping file whith this command INCLUDE 
$(FME_MF_DIR)FMI\LOG2RAP.FMI

If you have any comments or questions please post them here

Peter

_________________________________________________________________
Få 250 MB gratis lagerplads på MSN Hotmail:  http://www.hotmail.com


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

  Navn          : Peter Laulund, KMS

  Oprettet dato : 28 oktober 2004
                  20 maj     2005 Version 2

  Beskrivelse   : samlet udgave for alle formater
                  tilføjet header med version, adressse samt de vigtigste
                  parametre

                  zNull skal tilføjes

Problemer : brug variable og et namespace frem for global se også script


============================================================================*/

# ============================================================================= # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#Tcl2 source [regsub -all -- {\\} {$(FME_MF_DIR)} {/}]../TCL/lib/log2rap.tcl

Tcl2 source $gsPath2App/TCL/lib/log2rap.tcl                 ; \
    array set log::countKode {}                            ; \
    array set log::countBesk {}                            ; \
    array set log::countFeature {}                         ; \
    array set log::param { Source     $(SourceFormat)        \
                           Format     $(DestFormat)          \
                           Dataset    $(Dataset)             \
                           InProj     $(SourceCoordSys)      \
                           OutProj    $(DestCoordSys)        \
                           Dim        $(Dim)                 \
                           SourceDim  $(SourceDim)           \
                           DestDim    $(DestDim)  }        ;

# -----------------------------------------------------------------------------
# hvordan med ikke geometriske objekter skla de også tælles
# er det det rigtige sted at placere en default værdi ??
FACTORY_DEF * TeeFactory \ FACTORY_NAME "GENKA LOG: Tæl alle objekter" \ INPUT FEATURE_TYPE * kms_type geometri \ @SupplyAttributes(?, kms_descript, kms_descript, "< Ukendt kode >" ) \ OUTPUT FEATURE_TYPE * \ @Tcl2( "log::countType $(SourceFormat) $(DestFormat)" ) \
    @Log(countType, 1, 0)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FACTORY_DEF * CreationFactory \ FACTORY_NAME "GENKA LOG: Get Count" \ CREATE_AT_END \ NUMBER_TO_CREATE 1 \
 OUTPUT FEATURE_TYPE CountDummy

FACTORY_DEF * TeeFactory \ FACTORY_NAME "GENKA LOG: Write2Log" \ INPUT FEATURE_TYPE CountDummy \
    @Tcl2( "log::printCount {$(DestDataset)\$(DestFormat)}" )

#     @Tcl2( " catch { log::printCount {$(DestDataset)\$(DestFormat)}}" )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # =============================================================================
set comment {
===============================================================================

  Navn          : Peter Laulund, KMS

  Oprettet dato : 09 november 2004 - 14:37

Beskrivelse : hvordan hvis det er dsfl der er input og ufo der er output
                  så skal der formaters på en andne måde

                  det samme gælder hvis det samme foramt der er input og
                  output ( kun en kolonne ?? )

                  det bør være muligt at arbejde emd en template e.l. der
                  beskriver hele strengen og derefter lægge den i en
                  variabel ?? - brug evt. teknikken fra mail etc.

            test  skal zNull være en ekstra oplysning ?,
            test  2D / 3D data eller er det altid 3D ?

                  betegnelsen ukendt kode bør ikke sættes her men ske
                  samtidig med at data konverteres, det er kun i særlige
                  tilfælde det bør ske her

              OK  der skal også tages hensyn til attributter, hvordan de
                  oversættes skal også fremgå af filen

              OK  isoler i et selvstændigt namespace

              OK  dataset tilføjet som oplysning

==============================================================================}

# ============================================================================= # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace eval log {

proc countType {SourceForm DestForm} {
variable countKode ; variable countBesk ; variable countFeature ; variable fileName

    set key [FME_GetAttribute kms_code]
    if { "$key" == "" } { return }

    switch -- $SourceForm {
DSFL { set key "[FME_GetAttribute dsfl_class] [FME_GetAttribute dsfl_subclass]" }
       UFO      { set key [FME_GetAttribute kms_code] }
       default  { set key [FME_GetAttribute fme_basename] }
    }

    switch -- $DestForm {
       DSFL     { set subcl [ lindex [FME_GetAttribute dsfl_subclass ] 0 ]
                  set ff "[FME_GetAttribute dsfl_class] $subcl" }
       UFO      { set ff [FME_GetAttribute kms_code] }
       default  { set ff [FME_GetAttribute FinalFeature] }
    }

    if {![info exists countKode($key)]} {
        #puts "---------"
        set countKode($key)     1
        set countBesk($key)    [ FME_GetAttribute kms_descript ]
        set countFeature($key) $ff
        set fileName [ FME_GetAttribute fme_basename ]
    } else {
        incr countKode($key)
    }
}

# =============================================================================
proc printCount {path} {
variable countKode ; variable countBesk ; variable countFeature ; variable param


    catch {
    set f   "[regsub -all -- {\\} $path {/} ]/$log::fileName.KMS"
    }

    set ts  [ clock format [clock seconds] -format "%d %b %Y %H:%M" ]
    lappend retVal "[string repeat = 80]"
lappend retVal "LAN FME-Overbygning: Script Version $::lanVers frigivet d. $::lanDato"
    lappend retVal "Kort og Matrikelstyrelsen"
    lappend retVal "Rentemestervej 8"
    lappend retVal "DK 2400 København NV"
    lappend retVal "+45 35 87 50 50"
    lappend retVal "[EMAIL PROTECTED], www.kms.dk"
    lappend retVal {}
    lappend retVal "[string repeat - 80]"
    lappend retVal "Oversat dato          [format "%58s" $ts]"
lappend retVal "Parametre [format "%44s" Input][format "%20s" Output]"
    lappend retVal "[string repeat - 80]"
    lappend retVal "Datasæt        :[format "%64s" $param(Dataset)]"
lappend retVal "Format :[format "%44s" $param(Source)][format "%20s" $param(Format)]" lappend retVal "Projektion :[format "%44s" $param(InProj)][format "%20s" $param(OutProj)]" lappend retVal "Dimmensioner :[format "%44s" $param(Dim)][format "%20s" 3D]" lappend retVal "Højdesystem :[format "%44s" $param(SourceDim)][format "%20s" $param(DestDim)]" lappend retVal "zNull :[format "%44s" $param(zNull)][format "%20s" -999.00]"

    lappend retVal "[join [ getCountTab $param(Format) ] \n]"
    lappend retVal "[join [ getAttrMapDesc ] \n]"
    lappend retVal "[join [ getOrigin ] \n]"
    write2file $f [join $retVal \n] w
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
proc getCountTab {format} {
    variable countKode ; variable countBesk ; variable countFeature

    set sum 0 ; set res [list]
    set frm "%-12s%-12s%-44s%12s"
    switch -- $format {
       DSFL     { set ff "Dsflkode" }
       DWG      -
       DXF      -
       IGDS     { set ff "Lag" }
       UFO      { set ff "Genkakode" }
       default  { set ff "Tabel" }
    }

    lappend retVal [ string repeat = 80 ]
    lappend retVal [ format $frm "Kode" $ff "Beskrivelse" "Antal" ]
    lappend retVal [ string repeat - 80 ]

    foreach {t n} [array get countKode ] {
        set besk [string trim $countBesk($t) \" ]
        if {[string equal $besk "" ]} { set besk "< Ukendt kode >"}
lappend res [ format $frm $t [string trim $countFeature($t) \" ] $besk $n ]
        incr sum $n
    }
    lappend retVal [ join [lsort $res] \n ]
    lappend retVal [ string repeat - 80 ]
    lappend retVal [ format "Antal objekter skrevet %57d" $sum ]
    lappend retVal [ string repeat = 80 ]
    return $retVal
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #puts "---->så looger vi attributer"
#puts "\n-->" ; puts [ join [ getArrayLst attrInput ] \n] ; puts "<--\n" #puts "\n-->" ; puts [ join [ getArrayLst attrOutput ] \n] ; puts "<--\n"

proc getAttrMapDesc {} {
    variable ::attr::attrInput
    variable ::attr::attrOutput

    lappend retVal "\nIngen attributter fundet i data"
    if {[array size attrInput ] > 0 } {
        set frm "%-7s%-12s%-12s%-44s"
        set retVal [ list "\nBenyttede attributter:" ]
        lappend retVal  [ format $frm Kode Input Output Beskrivelse]
        lappend retVal "[string repeat - 80]"

        foreach {key val} [ array get attrOutput ] {
            #puts "$key $val"
            switch -- $log::param(Format) {
                 DSFL  { set val [ lindex [ join $val ] 0 ] }
            }
            set beskr [getBeskr $attrInput($key) ]
            lappend res [ format $frm $attrInput($key) $key $val $beskr ]
        }
        lappend retVal [ join [lsort $res] \n ]
    }
    lappend retVal "[string repeat = 80]"
    return $retVal
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
proc getBeskr {k} {

    set dbf $::gsPath2Resc/$::gsDataset/FELTER.DBF

    set retval ""
    set retval [ lindex [ getReccordLst $dbf BESKRIV [list KEY $k ] ] 0 0 ]
if {[string equal $retval "" ]} { set retval "< Ukendt attribut kode >" }
    return $retval

}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
proc getOrigin {} {

    set n [ array size  ::origin::originInput ]

    lappend retVal "\nAntal oprindelser skrevet $n"
    lappend retVal [ string repeat = 80 ]
    return $retVal
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

} ; # end namespace

#namespace import -force log::*

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # =============================================================================

Attachment: G09744.KMS
Description: Binary data

Reply via email to