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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

next_node()<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 1 (Synchronous)<br />

Result:<br />

result = mydata.order({global: "Customer", subscripts: [""]},<br />

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

Example 2 (Synchronous)<br />

Result:<br />

result = mydata.next({global: "Customer", subscripts: [3]},<br />

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

Example 3 (Asynchronous)<br />

mydata.next(<br />

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

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

);<br />

Result:<br />

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

Example 4 (Parse at the first level)<br />

key = {global: "Customer", subscripts: [""]};<br />

while ((key = user.next(key)).result != "") {<br />

console.log(JSON.stringify(key, null, '\t'))<br />

}<br />

Result:<br />

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

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

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

If there is no further subscript defined in the sequence then the result property will be returned as empty string<br />

("").<br />

4.12 next_node()<br />

The next_node() method gets the next global node in the collating sequence regardless of the level of subscript.<br />

Synchronous<br />

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

Asynchronous<br />

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

Parameters<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!