Interfaces for legacy vmd files

chm.transform{}

Contents

This function will perform a legacy transformation as one would have done with Chameleon in a filter prior to the Translator. It is available in Iguana 5.0.5 and up.

It takes these parameters:

  • ‘vmd’ – the VMD to use
  • ‘data’ – the message to transform
  • ‘config’ – (scripted transformation only) the configuration to use
  • ‘in_config’ – (graphical only) the inbound configuration
  • ‘out_config’ – (graphical only) the outbound configuration

It returns three values:

  1. The transformed message is returned
  2. Its name
  3. All Python output – i.e. from log and print statements

Here is an example of using it:

local Msg, MsgType,PythonOutput = chm.transform{ vmd='legacy.vmd', data=Data, config='default' }

Some caveats:

  • The vmd needs to be part of the Translator project and therefore be under source control.
  • But the python modules the code might use will just be on the general file system

The API is intended to make it convenient to write code to compare the output of equivalent Lua mapping code rather than be an API you would want to use for the long term.

The ability to capture the output from python can be invaluable. Say for instance your python code makes direct SQL inserts, then you could tweak that code to output those writes as print statements to make it visible within the Translator environment. Internally we have done some creative things like this to help customers migrate code. Talk to us if you using these APIs.

Leave A Comment?