Hi As pointed out by both Mark and I, it is possible to use an ListFactory and some tcl to solve this problem, When I started to look at the problem, it ende up beeing quit simpel to solve, The trick is to use the @SearchList() function to go from A to Z
With this solution we dont need any global variables / arrays at all, all we need is the index to the pressent element and the value of the next PNT_ID. The rest off the processing is don usiing FME Functions Attatched is a mapping file and tcl illustratiing this Peter Laulund >From: "Ron Cook" <[EMAIL PROTECTED]> >Reply-To: [email protected] >To: <[email protected]> >Subject: [fme] Sorting for PointConnector >Date: Sun, 13 Nov 2005 18:15:08 -0700 > >Hello, > >I am trying to create lines using the pointconnector operator in workbench. >Each row of data refers to a NEXT_POINT(char) and a PREV_POINT(char) >The first point has a PREV_POINT values of A and the last point has a >NEXT_POINT value of Z. A unique line is define by the combination of >TYP,ST_ID and JOB_NUM How do I sort the rows so that they are in the >correct >order for the pointconnector? Any ideas would be greatly appreciated. > > >TYP,ST_ID,PNT_ID,JOB_NUM,MEAS_ACC,NORTHING,EASTING,NEXT_POINT,PREV_POINT >MM,0002,-4230-75,030932,1,63212.74,458589.08,-4138-33,-4138-32 >MM,0002,-4138-33,030932,1,63212.40,458579.29,-4138-34,-4230-75 >MM,0002,-4138-34,030932,1,63211.97,458581.98,-4138-35,-4138-33 >MM,0002,-4138-35,030932,1,63211.89,458565.12,-4138-36,-4138-34 >MM,0002,-4138-36,030932,1,63211.74,458553.82,-4138-37,-4138-35 >MM,0002,-4138-37,030932,1,63211.22,458554.15,-4138-38,-4138-36 >MM,0002,-4138-38,030932,1,63211.56,458564.37,-4138-39,-4138-37 >MM,0002,-4138-39,030932,1,63211.49,458567.05,-4138-8,-4138-38 >MM,0002,-4138-32,030932,1,63212.16,458588.87,-4230-75,A >MM,0002,-4138-8,030932,1,63211.05,458577.80,Z,-4138-39 > > >Thank you > >Ron Cook B.Sc. >Geo-Innovations Inc >11713 10a Avenue >Edmonton AB >T6J 7A7 >(780) 951-0050 > > > > > > >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 > > > > > > _________________________________________________________________ Find det, du søger på MSN Søg http://search.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//* ============================================================================
Navn : Peter Laulund, KMS Oprettet dato : 16 november 2005 - 10:01 Beskrivelse : Problemer : ============================================================================*/# INIT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MAPPING_FILE_ID "Version 1.0, 16 november 2005" #LOG_FILENAME $(FME_MF_DIR)TEST.LOG LOG_APPEND no #FME_DEBUG MAPPING_FILE# MACRO- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DEFAULT_MACRO SourceFormat TEXTLINE
DEFAULT_MACRO DestFormat FFS
DEFAULT_MACRO SourceDataset $(FME_MF_DIR)data.txt
DEFAULT_MACRO DestDataset ${FME_TEMP}\csv.ffs
DEFAULT_MACRO SourceCoordSys
DEFAULT_MACRO DestCoordSys
DEFAULT_MACRO Dim 2D
#READER_META_ATTRIBUTES fme_feature_type fme_dataset fme_basename
# DATA DEF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
READER_TYPE $(SourceFormat) READER_KEYWORD INPUT INPUT_DATASET "$(SourceDataset)" #INPUT_COORDINATE_SYSTEM $(SourceCoordSys) WRITER_TYPE $(DestFormat) WRITER_KEYWORD OUTPUT OUTPUT_DATASET "$(DestDataset)" #OUTPUT_COORDINATE_SYSTEM $(DestCoordSys)# ============================================================================= # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#INCLUDE $(FME_MF_DIR)SORT.FMI # INCLUDE $(FME_MF_DIR)ELEM.FMI# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FACTORY_DEF * TeeFactory \ FACTORY_NAME "CSV: Output Transformer" \ INPUT FEATURE_TYPE * \ @FeatureType(&FinalFeature) \ OUTPUT FEATURE_TYPE * \ @Transform(FME_GENERIC, $(DestFormat)) \
@Log("Output logger", 3, 0)
# @KeepAttributes(fme_type, fme_geometry,TYP,ST_ID,JOB_NUM,MEAS_ACC)
\
#
=============================================================================
INPUT * OUTPUT *# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # ============================================================================= /* ============================================================================
Navn : Peter Laulund, KMS Oprettet dato : 16 november 2005 - 10:01 Beskrivelse : Problemer : ============================================================================*/# ============================================================================= # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tcl2 source $(FME_MF_DIR_UNIX)/csv.tcl# ============================================================================= FACTORY_DEF * TeeFactory \ FACTORY_NAME "CSV: Input Transformer and init array" \ INPUT FEATURE_TYPE * \ @Tcl2( initFeature ) \ OUTPUT FEATURE_TYPE * \
@Log("Input logger", 3, 0)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
FACTORY_DEF * TeeFactory
\
FACTORY_NAME "CSV: Drop header"
\
INPUT FEATURE_TYPE csvHeader# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FACTORY_DEF * ListFactory \ FACTORY_NAME "CSV: Combine features" \ INPUT FEATURE_TYPE * \ @RemoveAttributes(fme_regexp_match,text_l) \ GROUP_BY featId \ LIST_NAME cLst{} \ OUTPUT LIST FEATURE_TYPE * \ @Tcl2(procesList) \
OUTPUT SINGLETON FEATURE_TYPE *# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # =============================================================================
elem.tcl
Description: Binary data
