Translator FAQs

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

Very simple!

Just export your code (and optionally sample data) into a project zip file, and then import it into any component that uses a script.

See Exporting/Importing Projects for more information.

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.

These screen shots help to show how it works.

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:

Screen Shot 2014-07-17 at 20.14.29

Screen Shot 2014-07-17 at 20.15.37

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 so the environment is pulling in this dependency for you automatically. So remove this line before you remove abc from your project and you should be fine.

It’s an open question as to whether this was the best decision but it’s how the Translator is implemented currently. If you have an opinion one way or the other let us know.

To the use the  full browser window for coding you simply need to hide the Project Panel and 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 sample (or live) data in the Data parameter to the main() function.

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:

Screen Shot 2014-07-17 at 18.39.13

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

Screen Shot 2014-07-17 at 18.51.03

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

Screen Shot 2014-07-17 at 19.00.17

And here is the same code in a From Translator component. As you can see the code fails because there is no Data parameter:

Screen Shot 2014-07-17 at 18.51.23

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:

Screen Shot 2014-07-17 at 19.07.27 Screen Shot 2014-07-17 at 19.08.41

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?