Window Functions in DIAL
The window functions in DIAL operate on the bottom window of a cBase, Model, or Marker.
Returns a 1 if the bottom window of the specified model is empty and a 0 if it is not. This function can be used in a conditional to gain the same functionality as the "Skip Empty Windows" check box in Diver's Cascade Print dialog. If the bottom window fails to open, a warning of "no records selected" is returned, along with a value of 1.
Returns the number of rows in the bottom window of a Model stored in the special Object Variable model. If the bottom window fails to open, a warning of "no records selected" is returned, along with a 0 value. If the bottom window is a Report Palette, 0 is returned. However, the window still can be tested to be sure it is not empty by using the window.is_empty() function which returns 0 (false) even though the row count is 0.
Finds and selects a single row of the bottom window of the specified model that matches the value. If the bottom window is not a simple Tabular window, or the value is not found, the function returns false. If this function succeeds, it returns true.
Finds and selects the row with the specified index row_num in the bottom window of a Model stored in the special Object Variable model. The first row of the window is identified with row number 1. The row_num must not exceed the number of rows in the window (as returned by window.row_count()). To select the Group row after a call to marker.set_group(), use row_num 0.
Returns the window type of the bottom window of the Model stored in the special Object Variable model, as it would be displayed in Diver. If the bottom window fails to open, a warning of "no records selected" is returned, along with a value of "unknown". The following known values can be returned from this function: "TABULAR", "MULTITAB", "CROSSTAB", "MULTICROSSTAB", "REPORT", "SCATTER", "PLOT", "PIE", "REPORT", "MAP", "INFO", or "GRAPH".
Window Example
The following script demonstrates Window function usage. Comments are included in the script.
diveline.connect("localhost", "dial_user");
diveline.set_project("myProject");
marker.open(mymodel,"/models/salesperson.mrk");
// Counts the rows in a window
console.writeln("This windows contains \t" +window.row_count(mymodel) +"\t rows.");
// Tests if BAKER is in the bottom window
if (window.select_row(mymodel, "Baker")) {
console.writeln("Baker's Revenue Total is:\t" +Total[mymodel.Revenue]);
} else console.writeln("I did NOT find Baker in the window");
// Displays the Dimension Value and Revenue for row 5 of the bottom window
window.select_row_index(mymodel, 5);
console.writeln(Dimension[mymodel.Salesperson] +"s Revenue is\t" +Total[mymodel.Revenue]);
// Displays the type of the bottom window
console.writeln("The bottom window is of type\t" +window.type(mymodel));
// Disconnects
diveline.disconnect();