Skip to content

Noodle LineSetInvert() Method

Dan Kranz edited this page Sep 20, 2021 · 2 revisions

Reverse the position of all bits in an input set.

Returns 0 (zero) on success. Returns -1 if the input set doesn't exist.

Syntax

LineSetInvert(set)

Parameter Values

Parameter Description
set Key to input set that will be reversed

Example

var items = [
  ["1","Vegetable","Tree","1"],
  ["2","Animal","Bird","1"],
  ["3","Mineral","Diamond","1"],
  ["4","Vegetable","Flower","1"],
  ["5","Vegetable","Grass","1"],
  ["6","Animal","Cat","1"],
  ["7","Animal","Dog","1"],
  ["8","Mineral","Ruby","1"],
  ["9","Mineral","Quartz","1"]
];
var db1 = new Noodle(items, ["Seq","Category","Item","Count"]);

// Create a new data view, Items by Category
db1.InitializeView();
db1.EnterHeader(2);
db1.EnterColumnar(3);
db1.GenerateView();

// Select all rows with Category = "Vegetable"
// Save (mark) the matching rows in the "keep" set bitstring
if (db1.PruneBracket(0, "value", 2, "Vegetable", {"match": "keep"}))
  return;

// Reverse the set
if (db1.LineSetInvert("keep"))
  return;

// Apply the prune.  Shows "Animal" and "Mineral" rows in the view.
if (db1.ApplyPrune("keep"))
  return;
Clone this wiki locally