• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Nitro error in autocode generate program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nitro error in autocode generate program

    Hi all,
    When editing a generated file (by autocode) with Nitro, i have strange errors which i do not understand.
    Errors are on the sortFld and sortDir fields. Nitro says 'sortxxx used out of scope'.
    Is it a problem coming from Nitro ?
    Thanks in advance

  • #2
    Look at this code snippet from AutoCode:


    Code:
    		if (!dsMainDEMOGrid.sortInfo){																				
    			var sortFld = '';																							
    			var sortDir = '';																							
    		} else {																										
    			sortFld = dsMainDEMOGrid.sortInfo.field;																	
    			sortDir = dsMainDEMOGrid.sortInfo.direction;																
    		}
    Nitro follows very strict JavaScript code formatting rules than even CNX used in the past. The code example would be better like this:

    Code:
    		var sortFld = '';
    		var sortDir = '';
    		if (!dsMainDEMOGrid.sortInfo){																				
    			sortFld = '';																							
    			sortDir = '';																							
    		} else {																										
    			sortFld = dsMainDEMOGrid.sortInfo.field;																	
    			sortDir = dsMainDEMOGrid.sortInfo.direction;																
    		}
    Nitro will like this better because the sortFld and sortDir are defined outside of the if statement. This is only really necessary if you reference your fields more than once inside a block.

    You can simply ignore the error, the code will work fine. Or you can go through and clean it up. AutoCode is being completely refactored in an upcoming release so we are not currently working on making the existing version generate super-clean code.

    Comment


    • #3
      Hi Richard,
      Thanks for this reply, i understand now.

      Comment

      Working...
      X