07 June 2019

Neoxam: Reserved Words and Their Uses

This list is a work in progress. If you have any to add, please leave a comment with your suggestion.

Reserved Words with no Use

I found it confusing that some words common in other languages would show up as bold within Neoxam but would not perform any function.

     break

     continue

Reserved Words

     for (i=0: i<5; i+1) - Similar to other languages. However, break and continue to not work. If you
            want to exit on specific conditions, then you must use if blocks to set and check flags.

     foreach item in array - This will loop through each item of an array.

     if (1=1) - Executes the if block if the comparison is true.

     else - Follows and if block and executes if the preceding if statement is not true.

     while (i<5) - Executes until the given condition is no longer true.

     try - Denotes a block of code to execute. If an error occurs, the following "onerror" block will be
              executed. I would recommend encapsulating your rule (function) in a try so that you can
              provide a detailed error message via the onerror block.

     onerror - Similar to the catch block in Java. The code in this block will execute if there is an error
                      in the preceding try block.


     return - Exits the rule (function) with the optional given value. Returning zero at the end of a
                   successfully executed function is not required, but can be useful in conjunction with
                   some automation tools.
   

Neoxam: Shortcuts

This page is a work in progress. Feel free to contribute in the comments.

Many common shortcuts work in Neoxam, such as Ctrl X, Ctrl C, Ctrl V, etc. Here are some of the Neoxam specific ones:

Ctrl+H - Open the audit trail (history)
Ctrl+I - Open the inspector for whatever item has focus
Ctrl+Q - Exits the application
Ctrl+T - Brings up audit history. This is a different view than right clicking or Ctrl+H.
Ctrl+G - Opens the config window for the screen in focus.

F3 - When you click on the name of a rule being called in a script, you can hit F3 to bring up the implementation of the called rule.

04 June 2019

Neoxam: Null vs Empty Quotes

I want to start writing about my experiences with Neoxam development since there are not very many resources out there. I am by no means an expert, so please feel free to comment on any corrections. Hopefully someone will find these posts to be helpful.

Disclaimer: I do not work for Neoxam. My advice/knowledge in these posts do not represent my employer and are just general tips/knowledge. Use them at your own risk.

Null vs Empty Quotes 
Neoxam uses a propriety scripting language. While many languages include the null keyword, Neoxam does not.

If you were to declare a variable that ends up empty and compare it to null, that comparison may work, but maybe not for the reason you think. When your variable is not assigned anything, it is null/empty. When you compare it to null, what you are actually doing is comparing it to another undefined variable.

     sql := "SELECT * FROM  MyTable WHERE custID in ('1', '2')"; //Assume this does not return anything
     myVariable := sqlResult(sql);
     if(myVariable == null){
          //do something
     }
   
So in most cases this comparison will work because you are comparing your empty variable with an undefined variable.

This example is only one very specific scenario. You need to be cautious as null may not work as expected in all scenarios. You can also encounter issues if someone else assigns a value to the variable null. 

A better approach is to us the empty string - "". You could even define the variable null to contain it, although I prefer to use "" to avoid confusion.

    if(myVariable == ""){
          //do something
     }

Or

      null := "";
      if(myVariable == null){
          //do something
     }