Code Monkey home page Code Monkey logo

fme-listappender's Introduction

FME® ListAppender

About

The ListAppender adds new elements to an existing list, starting at a desired key or at the first available one. The user can set the values for the elements, based on constants, parameters or other feature attributes.

IMPORTANT

A user can specify a regular attribute for the List Attribute input parameter of this transformer, which will result in all features being rejected. The reason why this is possible in the first place, is because the ListAppender also supports nested lists, but FME has no parameter type that only allows selection of the "deepest nested list". Therefore, the only way this can be achieved, is by using a regular attribute input parameter, that will show the list key selection dialog once a list attribute has been selected. Below are a couple of examples that explain how the List Attribute parameter can be used.

Example 1
If the user wants to append elements at the end of nested list parent{3}.child{} (i.e. append children to parent nr. 3), the List Attribute input parameter should be set to parent{3}.child{0}. As a general rule, setting the last key to 0 means "just append the values at the end of whatever is there already". This means that even if parent{3}.child{} contains 6 elements (keys 0 - 5) already, the ListAppender will start appending values at key 6. No elements will ever be overwritten.

Example 2
If the user wants to append elements starting at exactly key 8 of list example{} (i.e. add elements example{8}, example{9}, etc.), the List Attribute input parameter should be set to example{8}. Note that if this list contains more than 8 elements already (e.g. 10 elements, so keys 0 - 9), the new ones will be appended starting at key 10 and further. No elements will ever be overwritten.

Example 3
If the user wants to append elements at the end of list example{}.value, the List Attribute parameter could be set to example{0}.value. If the user has specified 3 new items to add and the list already contained 2 elements, the result will be:
example{0}.value = 'existing item1'
example{1}.value = 'existing item2'
example{2}.value = 'new item1'
example{3}.value = 'new item2'
example{4}.value = 'new item3'

Note that if the ListAppender failed to append attributes to the list, the feature will be rejected and a _listappender_error attribute containing the failure reason will be added.

Notes

  • Also available on FME Hub for convenient installation.
  • This transformer has been tested on Python 2.7 and 3.4.
  • Released under GNU General Public License v3.0.
  • If you notice a bug or desire a new feature, please contact me. Or make a pull request!
  • The test workspace is used for testing and provides some examples.

Usage

List Attribute
Select the list to which you would like to add new elements. Note that you can select regular attributes as well, but this will not work. Please refer to the examples in the Overview section.

Values to Add
Sets the element values you would like to append to the list. The number of values you specify here equals the number of elements that will be added. You can choose to insert values from other (list) attributes, parameters or constants, including null.

fme-listappender's People

Contributors

geosander avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.