Translator FAQs

This section contains answers to common questions about using the Iguana Translator.

To transfer a complete channel:

  1. Export the channel (and optionally sample data) to an external repository
  2. Import the channel from from the repository you exported to

To transfer a single component:

  1. Export your code (and optionally sample data) into a project zip file.
  2. Import the project zip file into a scripting component.

To transfer code:

  1. Simply use copy and paste.

Basically you just use the Tab key to indent code, you can indent the current line, or select a block of code and indent it all at once.

Say you type in a function like this:

Then to get the auto-indentation to kick in just press the Tab key at any point on the line, then the editor moves the end block so that it matches the start of the function:

Or you can press Tab key to indent a selected block of code:

This can be confusing.

You try to remove the abc module from your project but it keeps on re-appearing in the Project Files pane.

The reason this is happening is that there is a require 'abc' line somewhere in your project and the Translator is pulling in the dependency automatically. So remove just remove the require 'abc' line before you remove abc from your project and you should be fine.

To the use the full browser window for coding you simply need to hide the Project Panel and hide the Thumbnail. You may also want to maximize the browser window.

A couple of things:

Nothing is wrong, this is the correct behavior, though it can seem odd to new users.

The reason is simple enough: A From Translator component can only use Lua code to grab data (from disk, or a web service etc). Because of this a From Translator component will never receive data (sample or live) in the Data parameter to the main() function.

The Translator simply mimics how this component runs in a live situation by not passing sample data to it.

Tip: For the same reason you cannot resubmit messages to a From Translator.

Clear as mud? Well lets approach it from the other direction.

There are three From components that support sample data for their scripts:

  • LLP Listener: Receives HL7 messages from a socket
  • From HTTPS: Receives data from a web service
  • From Channel: Receives queued messages from another channel

All of these components have a built-in listening/receiving function, and when they get a message it is passed into main() using the Data parameter. The Translator simply mimics how these components run in a live situation by passing sample data to main() using the Data parameter.

A From Translator is different as it does not have a built-in listening/receiving function and uses code to grab data from disk. The Translator again mimics the live behavior by not passing data to main() (hence no sample data), which is exactly how the live channel works.

Perhaps an example will help.

Let’s use a single line of code in an LLP Listener to parse an HL7 message.

First we show it using sample data, which works correctly:

Then without sample data which causes an error because the Data parameter is empty/blank:

Now let’s run the channel, and as you can see it works without error:

And when we put the same code in a From Translator component, it fails because there is no Data parameter:

Note: The error message indicates that the Data parameter is missing. This is because Iguana is not passing a value to main() and therefore the parameter is undefined (nil).

So let’s double check by running the channel, and as you can see it fails with the same error we saw in the Editor:

Simple, there are no messages to resubmit!

This is because a From Translator component can only use Lua code to grab data (from disk, or a web service etc). Therefore a From Translator component never receives (queued) input data in the Data parameter to the main() function.

Tip: For the same reason there is also no sample data available in a From Translator.

Conclusion: No input data is queued for this component, so there is no data to be resubmitted.

Clear as mud? Well lets approach it from the other direction.

There are three From components that receive input data for their scripts:

  • LLP Listener: Receives HL7 messages from a socket
  • From HTTPS: Receives data from a web service
  • From Channel: Receives queued messages from another channel

All of these components have a built-in listening/receiving function, and when they get a message it is queued and then passed into main() using the Data parameter.

A From Translator is different as it does not have a built-in listening/receiving function and uses code to grab data from disk. Therefore the Translator has no input data to pass to main() in the Data parameter, hence there is no queued input data.

Conclusion: No input data is queued for this component, so there is no data to be resubmitted.

Leave A Comment?