Skip to main content

GetStopIfTrue

Returns whether the editor will stop evaluating additional formatting rules if this rule evaluates to true.

Syntax​

expression.GetStopIfTrue();

expression - A variable that represents an ApiUniqueValues class.

Parameters​

This method doesn't have any parameters.

Returns​

boolean

Example​

Check whether a unique values rule prevents the lower priority rules from being applied in a spreadsheet.

// How do I find out if a unique values rule stops the evaluation of the other rules in a spreadsheet?

// Read the "stop if true" flag of a unique values rule in a spreadsheet.

let worksheet = Api.GetActiveSheet();

worksheet.GetRange("A1").SetValue("Sales Data");
worksheet.GetRange("A2").SetValue(100);
worksheet.GetRange("A3").SetValue(250);
worksheet.GetRange("A4").SetValue(150);
worksheet.GetRange("A5").SetValue(300);
worksheet.GetRange("A6").SetValue(75);

let dataRange = worksheet.GetRange("A2:A6");
let formatConditions = dataRange.GetFormatConditions();

let uniqueValues = formatConditions.AddUniqueValues();
uniqueValues.SetFillColor(Api.RGB(255, 0, 0));
uniqueValues.SetStopIfTrue(true);

worksheet.GetRange("C1").SetValue("Stop if true:");
worksheet.GetRange("C2").SetValue(uniqueValues.GetStopIfTrue() ? "Yes" : "No");