Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add CFScript example

...

This example returns a list of account names, presuming the IGLS accounting package is installed on the host.

 


Code Block
languagejs
titleCFScript
linenumberstrue

var mumps = new lib.cfmumps.Mumps();
mumps.open();

var lastResult = false;
var nextSubscript = "";

writeOutput("<ul>");

while(!lastResult) {
	
	var order = mumps.order("TT", ["ACCT", nextSubscript]);
	lastResult = order.lastResult;
	nextSubscript = order.value;

	if(nextSubscript) {
		var accountName = mumps.get("TT", ["ACCT", nextSubscript]);
		writeOutput("<li>" & accountName & "</li>");
	}
}

writeOutput("</ul>");

mumps.close();


Code Block
languagecoldfusion
titleCFML
linenumberstrue
<cfset mumps = new lib.cfmumps.Mumps()>
<cfset mumps.open()>

<ul>
	<cfset lastResult = false>
	<cfset nextSubscript = "">
	
	<cfloop condition="lastResult EQ false">
  		
		<cfset order = mumps.order("TT", ["ACCT", nextSubscript])>
  		<cfset lastResult = order.lastResult>
  		<cfset nextSubscript = order.value>
  		
		<cfoutput>
    		<cfif nextSubscript NEQ "">
      			<li>#mumps.get("TT", ["ACCT", nextSubscript])#</li>
    		</cfif>
  		</cfoutput>

	</cfloop>
</ul>

<cfset mumps.close()>

...