Skip to content

Noodle WhereIsField() Method

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

Returns the location of a field within the current data view.

Location values:

Location value
HEADER_FIELD 1
HEADER_SUM 2
COLUMNAR_FIELD 4
COLUMNAR_SUM 8

Syntax

WhereIsField(bfi)

Parameter Values

Parameter Description
bfi Index of the desired field

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();

// Where is Item?
var location = db1.WhereIsField(3);  // Returns COLUMNAR_FIELD

if (location & COLUMNAR_FIELD) {
  // do something
}
else if (location & HEADER_FIELD) {
  // do something else
}
Clone this wiki locally