Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculateOverallStatus() {
- var ss = SpreadsheetApp.getActiveSpreadsheet();
- var rng = ss.getRange("E15:E99"); // Specify the range to scan
- var x = 0;
- overall = "";
- // Begin scanning
- for (x = 0; x < rng.getNumRows(); x++) {
- if (rng.getValues()[x][0] == "Passed") {
- overall += ";Passed";
- } else if (rng.getValues()[x][0] == "Failed") {
- overall += ";Failed";
- }
- }
- // end scanning
- // Begin result processing
- if (overall.toLowerCase().indexOf('fail') != -1) {
- overall = "Failed";
- } else if (overall.toLowerCase().indexOf('pass') > 0 && overall.toLowerCase().indexOf('fail') == -1) {
- // Must not have any fails
- overall = "Passed";
- } else {
- if (overall == "") { overall = "Not executed"; } else { overall = "Failed"; }
- }
- // End result processing and display
- return overall;
- }
Add Comment
Please, Sign In to add comment