Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helpful document update to Transforms #453

Open
iwills opened this issue Apr 21, 2017 · 0 comments
Open

Helpful document update to Transforms #453

iwills opened this issue Apr 21, 2017 · 0 comments

Comments

@iwills
Copy link

iwills commented Apr 21, 2017

In the ZenPackLib example, it shows a transform written as follows:

name: ZenPacks.acme.Events

event_classes:
  /Status/Acme:
    remove: false
    description: Acme event class
    mappings:
      Widget:
        eventClassKey: WidgetEvent
        sequence:  10
        remove: true
        transform: "if evt.message.find('Error reading value for') >= 0:\n\
          \   evt._action = 'drop'"

For longer transforms, you can use the following format, which is way easier than having to wrap everything in " and including \n and \, because you can just cut and paste code and adjust indenting to match the level of the "transform" key + one level of indent, i.e.:

name: ZenPacks.acme.Events

event_classes:
  /Status/Acme:
    remove: false
    description: Acme event class
    mappings:
      Widget:
        eventClassKey: WidgetEvent
        sequence:  10
        remove: true
        transform: |
          if evt.message.find('Error reading value for') >= 0:
            evt._action = 'drop'

Hope that helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant