span8
span4
span8
span4
Previous: Adding a Column to a Table
Sorting tabular data can be done multiple ways using FME.You can sort attributes using the FME Data Inspector to manually order columns or by using theSorterTransformer in the Workbench.The Sorter functions similar to the SQL function: ORDER BY.In this tutorial,you will learn how to sort tabular data in the FME Data Inspector and using the Sorter Transformer.
Note: Since you are在一个公共数据库面临的工作,tables can occasionally be overwritten and/or modified.If your translation produces unexpected results,see theResetting the PostGIS Training Databasearticle.Alternatively,you can download the provided file(s) and replace the PostGIS reader with a reader of the appropriate format.
In this scenario,you want to have the ability to sort your tabular data in ascending or descending order (either alphabetically or numerically) using the FME Data Inspector.
If the attributes aren't sorting correctly you may be using the wrong sorting method.Right-click on the column header and select the Sort Numeric Ascending sorting method from the drop-down list.
In this scenario,you want to have the ability to sort your tabular data by multiple columns.First,you want your table sorted alphabetically by the maintainer field then numerically by the fountainid field in descending order.
Note: The scenario presented here is likely different than the intended real-world application.Because of the challenges of working with a public facing database,here you will read from the DrinkingFountains table and eventually write to a table named DrinkingFountainsSorted.You might notice DrinkingFountainsSorted already exists with the intended data model because other users would have also run the same workspace.In reality,you would likely read from DrinkingFountains,and use the Table Handling "Use Existing" since you are only reordering features in the table.
Note: the shortcut to generate a workspace is Ctrl+G
Note: Drop and Create is used when a table needs to be emptied and an update is made to the database schema.For example,drop and create is used to remove the table structure,possibly to add or remove columns,change data types,etc.For more information on Writer Feature Type Parameters such as Table Handling,see theDocumentation.
Note: An Automatic Attribute Definition is when Workbench automatically defines the list of attributes,depending on which Reader feature types are connected.Further,the list of attributes on the Writer feature type will update automatically whenever attributes are changed (i.e.renamed,removed,etc.) in the workspace.For more information on User Attributes and Attribute Definitions,see theDocumentation.
Note: the order of the Sort By operations will determine which column is sorted first (top of the list gets sorted first).You can adjust the order of each sort condition using the up and down arrows near the bottom of the dialog.
After running the table,your table will be sorted by the ordering methods that were defined in the Sorter Parameters.You can view the new table by selecting the writer and clicking the Inspect button in the shortcut menu that appears when the writer is selected.
Data used in this tutorial originates from open data made available by theCity of Vancouver,British Columbia.It contains information licensed under the Open Government License - Vancouver.
© 2019 亚搏在线Safe Software Inc |Legal