Guest User

Untitled

a guest
Jun 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function calculateOverallStatus() {
  2. var ss = SpreadsheetApp.getActiveSpreadsheet();
  3. var rng = ss.getRange("E15:E99"); // Specify the range to scan
  4. var x = 0;
  5. overall = "";
  6. // Begin scanning
  7. for (x = 0; x < rng.getNumRows(); x++) {
  8. if (rng.getValues()[x][0] == "Passed") {
  9. overall += ";Passed";
  10. } else if (rng.getValues()[x][0] == "Failed") {
  11. overall += ";Failed";
  12. }
  13. }
  14. // end scanning
  15. // Begin result processing
  16. if (overall.toLowerCase().indexOf('fail') != -1) {
  17. overall = "Failed";
  18. } else if (overall.toLowerCase().indexOf('pass') > 0 && overall.toLowerCase().indexOf('fail') == -1) {
  19. // Must not have any fails
  20. overall = "Passed";
  21. } else {
  22. if (overall == "") { overall = "Not executed"; } else { overall = "Failed"; }
  23. }
  24. // End result processing and display
  25. return overall;
  26. }
Add Comment
Please, Sign In to add comment