西班牙
斯潘4
翻译开始时间:$gTranslationStartTime\nTranslation结束时间:[时钟格式[时钟秒]]\"
最后{}{\全局FME_Status;如果{$FME_Status == "1"} {\ put \"翻译成功\";else {\ put \"翻译不成功";\};\};同样的例子也可以不使用过程来编写:
如果{$FME_Status == "1"} {\ put \"Translation was successful\";else {\ put \"翻译不成功";\}
这个映射文件中用于设置目标# dataset目录的宏是DestDataset。DWG_DATASET " $ (DestDataset) " # Source in the Tcl script to run at the conclusion of this translation.脚本与这个映射文件存储在同一个目录中。FME_BEGIN_TCL源(FME_MF_DIR_UNIX) / backup.tcl美元;备份{$ (DestDataset)}
proc backup {filename}{如果{[file exists $filename]} {file copy -force $filename $filename.bak}}
在翻译结束时运行的Tcl脚本中的# Source。脚本与这个映射文件存储在同一个目录中。$ (FME_MF_DIR_UNIX) / tryAnother.tcl FME_END_TCL来源
设置outputFile [open c:/temp/status.txt w+] if {$FME_Status == "1"} {put $outputFile "Translation was successful"} else {put $outputFile "Translation failed—running alternateTranslation " exec fme.exe alternateTranslation。关闭$outputFile
FME_LogMessage fme_inform {hi dale内联}
从pyfme导入* log=FMELogfile() log.log("howdy")
FME_END_TCL设置输出文件[打开$FME_LogFileName a];\放$outputFile {};\放$outputFile{写一些东西在结尾};\放$outputFile {};\接近outputFile美元;
设置一个映射文件id,这样Tcl结束过程#“知道”哪个映射文件正在运行MAPPING_FILE_ID形状到AutoCAD #记录所有的消息编号,以便我们以后可以只提取那些#我们感兴趣的。在翻译结束时运行的Tcl脚本中的LOG_MESSAGE_NUMBERS yes #源代码。脚本与这个映射文件存储在同一个目录中。$ (FME_MF_DIR_UNIX) / tclFinalization.tcl FME_END_TCL来源
#打开一个文件写的翻译数据集outputFile[打开c: / temp / stats_out.txt w +] #检查翻译状态和输出所需的消息如果{$ FME_Status = = " 1 "}{把$ outputFile“翻译是成功的”}其他{把$ outputFile“翻译失败”把美元outputFile“错误消息是:$ FME_FailureMessage "};在映射文件中使用MAPPING_FILE_ID设置唯一的映射文件标识符。把美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“把美元outputFile”特性总结“把美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“#循环功能类型的分类列出,阅读,和输出#计数为每个一套formatSpec”% -65年代:% 12 s“foreach featType lsort [FME_FeaturesRead数组名称]]{把$ outputFile[格式$ formatSpec featType FME_FeaturesRead美元($ featType)]}将美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“把美元outputFile[格式formatSpec美元“总功能读“FME_TotalFeaturesRead美元);把美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“把美元outputFile”“把美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“把美元outputFile“功能写总结”把美元outputFile”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -“#循环排序列出的功能类型,and output the # count for each one foreach featType [lsort [array names FME_FeaturesWritten]] { puts $outputFile [format $formatSpec $featType $FME_FeaturesWritten($featType)] } puts $outputFile "" puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile [format $formatSpec "Total Features Written" $FME_TotalFeaturesWritten] puts $outputFile [format $formatSpec "Total Coordinates Written" $FME_TotalCoordinates] puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile "" # Look for any lines in the logfile that were warnings, and output a count of them to # the summary file.同时,check if there was any "unexpected input remover" # statistics line and report a non-zero count if there was (this may happen # when workbench generated mapping files are run against input datasets # with different feature types than those that were expected) # And also fish out the system status log message (which is #246014) and copy # it into the output file set logFileExists [file exists $FME_LogFileName] set warnings 0 if {$logFileExists} { set logFile [open $FME_LogFileName r] while {[gets $logFile line] >= 0} { if {[regexp {WARN} $line]} { incr warnings } elseif {[regexp {#246014} $line]} { puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile $line puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile "" } elseif {[regexp {Unexpected Input Remover} $line]} { set totalFeatures 0 set acceptedFeatures 0 set rejectedFeatures 0 set line [regsub {^.*Unexpected} $line {Unexpected}] catch {scan $line "Unexpected Input Remover(TestFactory): Tested %d input features -- %d features passed, %d features failed." totalFeatures acceptedFeatures rejectedFeatures} if {$rejectedFeatures > 0} { puts $outputFile "---------------------------------------------------------------------------- ---" puts $outputFile [format $formatSpec "Features with Unexpected Feature Types" $rejectedFeatures] puts $outputFile "---------------------------------------------------------------------------- ---" puts $outputFile "" } } } close $logFile } puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile [format $formatSpec "Logfile $FME_LogFileName Warnings" $warnings] puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile "" puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile [format $formatSpec "Total Elapsed Time (seconds)" $FME_ElapsedTime] puts $outputFile [format $formatSpec "Total CPU Time (seconds)" $FME_CPUTime] puts $outputFile "-------------------------------------------------------------------------------" puts $outputFile "" # And close the file close $outputFile
本例使用外部脚本使用TclODBC包将翻译活动的记录插入数据库。在本例中,创建了一个Access数据库(如果需要的话),并为每个完成的转换填充一行。
tclobc公司
要在FME环境中使用TclODBC,请执行以下步骤:
$ (FME_MF_DIR_UNIX) / recordTranslationODBC.tcl FME_END_TCL来源
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = # # recordTranslationODBC。这个脚本使用# TclODBC包记录转换的执行。此示例包括创建用于存储翻译结果的# Access数据库和表。每次转换运行都将一行插入到表中。注意,对于一个实际的生产系统,“put”语句#将被删除。包需要tclodbc # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = # #设置一些变量来创建和连接中使用#通过ODBC数据库设置司机“Microsoft Access司机(* . mdb)“dbfile c: /翻译。mdb将dsn XLATION # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = #创建数据库如果不是已经存在。如果#数据库是基于服务器的,我们不会这样做,但是对于本例,我们只使用Access。如果{!“创建数据库$DBFILE”数据库配置CONTIOSDSN$$Realth[Real] CytAydB= \“$DBfile \“一般”] } {使用“现有数据库$DBFILE”} [文件存在$DBFIL] }{如果它已经在那里了。如果我们使用ODBC连接到一个“真实”数据库,那么我们只假设DSN已经是有效的catch{database configure remove DSN$driver“DSN=$DSN”}database configure a d d DSN$driver[list“DSN=$DSN=$DSN”“dbq=$DBFILE”]database db$DSN$driver[list“DSN=$DSN”“dbq=$DBFILE”]database db$DSN$DSN$driver[list“DSN=$DSN”[list“DSN=$DSN”“dbq=$DBFILE”]database db db数据库db$DSN$DSN$DSN[DSN$DSN$DSN$DSN$DSN$DSN$DSN$DSN$DSN=====创建我们想要的表如果{[llength[db tables xlation_results]==0}{将“creating xlation_results table in database$dbfile”db“create table xlation_results”(mappingfileid varchar(50),starttime timestamp,endtime timestamp,cputime double,successful char(3),则插入(如果尚未插入)。numfeatures integer)“}else{puts”xlation_results table present in database$dbfile“}else{puts”xlation_results table存在于数据库$dbfile“}else{puts”xlation挈u results table中,现在我们可以插入行,提交它了,如果{$fme_status==0}{set success no}db“插入到xlation结果(mappingfileid,starttime,endtime,cputime,successful,numfeatures)值('$fme_mappingfileid',\{ts'$fme_startingtimestamp'},'{ts'$fme_endingtimestamp'},$fme_cputime,'$success',$fme_totalfeatureswrited)“db commit”,则断开与数据源的连接set success yes数据库断开连接如果连接到基于服务器的数据库,则可能不会在最后删除ODBC DSN。但由于我们是基于文件的,所以我们将删除它数据库配置删除dsn$driver“dsn=$dsn”
本例使用外部脚本,使用oratcl包将翻译活动的记录插入到oracle数据库中。
雄辩
要在FME环境中使用ORATCL,请遵循以下步骤:
fme_end_tcl source$(fme_mfu dir_unix)/recordtranslationoracle.tcl
#一个脚本使用oratcl包记录翻译的执行。此示例包括创建用于存储翻译结果的“xlation”结果表。每次转换运行都将一行插入到表中。包需要Oratcl # ========================================================================= # Login to the Oracle service set username scott set password tiger set service amidala set loginHandle [oralogon $username/$password@$service] # ========================================================================= # Determine if the 我们希望将结果记录到存在集合表中,不存在STATEMESTANDLE(ORAOPEN$ $ Login句柄)ORASQL $ STATEMESTANDELE“从USER表中选择*,其中TabLEYNAME==XLATIORIX结果”,而{[OrAftETC$STATEMESTANDLE -DATAVALIABLE ROUL]==0 }{SETABLE存在“是”}如果我们需要{{$table table = =“否”}{Orasql $ StestEnEndEl“创建表XLATION结果(MappIn FILID ID VARCHAR(50)),启动时间戳,终端时间戳,CPUTIME浮标,XlationSuccessful CHAR(3))财产税NumFeatures integer)“}\\r\n\r\n\r\r\n\r\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\r\n\r\r\n\r\r\n\r\r\n\r\n\r\n\r\r\n\r\r\n\r\r\n\r\r\n\r\r\n\r\r\n\r\r\r\n\r\r\r\n\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\n cputime,xlation成功,numfeatures)值('$fme_mappingfileid',timestamp'$fme_startingtimestamp',timestamp'$fme_endingtimestamp',$fme_cputime,'$success',$FME_TotalFeaturesWritten)" -commit # ========================================================================= # Shut down the statement handle oraclose $statementHandle # ========================================================================= # Logout of our oracle service oralogoff $loginHandle
?2019安全亚搏在线软件公司|合法的