25.01.2015 Views

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

Using Node.js with Caché - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

function()<br />

• 1 — <strong>Node</strong> has data but no subnodes.<br />

• 10 — <strong>Node</strong> does not have data but has subnodes.<br />

• 11 — <strong>Node</strong> has data and has subnodes.<br />

Synchronous<br />

Asynchronous<br />

Parameters<br />

var result = mydata.data(node);<br />

mydata.data(node, callback_function);<br />

• node — the global node to be accessed.<br />

• callback_function — a function of the form function(error, result){} used to return results<br />

asynchronously (see “Synchronous vs. Asynchronous cache.node Methods”).<br />

Example<br />

mydata.data(<br />

{global: "Customer", subscripts: [1]},<br />

function(error, result) { // callback code }<br />

);<br />

Result:<br />

{defined: 11}<br />

4.4 function()<br />

The function() method provides a way to invoke a <strong>Caché</strong> function directly.<br />

Synchronous<br />

Asynchronous<br />

Parameters<br />

var result = mydata.function(<br />

Cache_Function_Name,<br />

Arguments ...<br />

);<br />

var result = mydata.function(<br />

{<br />

Cache_Function_Name,<br />

Arguments ...<br />

},<br />

callback_function<br />

);<br />

• Cache_Function_Name<br />

• Arguments<br />

• callback_function — a function of the form function(error, result){} used to return results<br />

asynchronously (see “Synchronous vs. Asynchronous cache.node Methods”).<br />

<strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong> 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!