Published
Edited
Jul 13, 2021
Insert cell
Insert cell
baseUrl = "https://play.hpccsystems.com:18010/"
Insert cell
Insert cell
logicalFile = "~progguide::exampledata::people";
Insert cell
Insert cell
hpccComms = require("@hpcc-js/comms");
Insert cell
Insert cell
result = hpccComms.Result.attachLogicalFile({baseUrl}, "thor", logicalFile).refresh();
Insert cell
Insert cell
result.fields();
Insert cell
Insert cell
result.fetchRows(5, 7, false, { lastname: "HAM" });
Insert cell
Insert cell
{
yield `...creating wu...`;
// The ECL Template ---
const ecl = `\
r := RECORDOF('${logicalFile}', { INTEGER personid, STRING state, STRING gender }, LOOKUP);

ds := DATASET('${logicalFile}', r ,THOR);

ds(state='FL', gender='F', personid > 100, personid < 200);
`;

// Submit the ECL (returns a Workunit) and wait for completion ---
const wu = await hpccComms.Workunit.submit({ baseUrl: baseUrl }, "hthor", ecl);
yield `...executing wu...`;
await wu.watchUntilComplete();

// Fetch list of results ---
yield `...fetch results wu...`;
const results = await wu.fetchResults();

// For the first result fetch its "rows" ---
const rows = await results && results.length ? results[0].fetchRows() : [];

// Tidy up after us ---
yield `...deleting wu...`;
wu.delete();
// Return the results ---
yield rows;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more