I know I'm missing something, but please know that I have poured over Stack, and other resources as well, and I have tried and modified a number of base scripts, and worked with formulas, and still haven't found the missing element(s). I have a "Main" Google Sheets tab that, when finished, only myself and the Director of Operations are intended to have access to. The Quick View tab, I think, is fine as is as it is only intended to provide a limited overview to Sales and a couple of CSRs and doesn't require interaction. The other tabs are department specific and are intended to show the job and priority when the requisite preceding step has been completed (e.g. "Plated" in PREPRESS to show that a job is ready for Offset Printing on WEB). Overall, what I have in Apps Script works, as rows do move accordingly between tabs based on the Priority assigned. And 2 of the 3 "Hide Rows" bits are working correctly. (I'm not sure why the one for WEB isn't displaying correctly even though I set it up like DIGITAL and BINDERY script-wise, but I'm working on it.) My one biggest remaining problem is that whether I use ="Sheet"!Cell, or call in ranges, checked boxes do not move along with the rows accordingly (e.g. If a job/row has been checked as "Plated" from PREPRESS to WEB, or "Printing Complete" from WEB or DIGITAL to BINDERY (and all back to "Main"), the checked box doesn't move if the priority is changed in column A.). I apologize in advance as, depending on which tab you look at, there may be inconsistent formulas as I continue to troubleshoot and try things. Any assistance, even if it is just directing me to a resource I may not have found yet, much appreciated. I learn by doing. Thanks! Here is the link to my sheet > https://docs.google.com/spreadsheets/d/1sz4LPGtZaiNY7acg9qN5vPehb7ldhIfjhhctiTja9rE/edit?usp=sharing
As previously mentioned, I've tried both ="Sheet"!Cell for calling in data from one sheet to another, as well as calling in ranges via QUERY. Because the checkboxes are intended to trigger whether a row shows, or doesn't show, for WEB and BINDERY (but also needs to show correctly in general) I need said checkboxes to move with the job-row when the Job Priority is changed in column A on Main. In addition to formulas, I was also trying variations on this script (although not currently included in my active onEdit script):
function onEdit(e) { const sh = e.range.getSheet(); if (sh.getName() == "Sheet2" && e.range.columnStart == 6 && e.value == "TRUE") { let id = e.range.offset(0, -1).getValue(); let osh = e.source.getSheetByName("Sheet1"); let vs = osh.getDataRange().getValues().forEach((r, i) => { if (r[4] == id) { osh.getRange(i + 1, 4).setValue('whatever you want') } }); }}
My current active onEdit script (as previously mentioned, the part for the WEB tab is not working, even though the equivalent parts for DIGITAL and BINDERY seem to work overall) is:
function onEdit(e) {{var ss = SpreadsheetApp.getActiveSpreadsheet();var s = ss.getSheetByName("WEB");var row = s.getRange('O:O').getDisplayValues();s.showRows(1, s.getMaxRows());for(var i=2; i< row.length; i++){ if(row[i] == 'FALSE') {s.hideRows(i+1, 1);}}}{var ss = SpreadsheetApp.getActiveSpreadsheet();var s = ss.getSheetByName("DIGITAL");var row = s.getRange('N:N').getDisplayValues();s.showRows(1, s.getMaxRows());for(var i=2; i< row.length; i++){ if(row[i] == '206-Hantscho' || '205-HH V15') {s.hideRows(i+1, 1);}}}{var ss = SpreadsheetApp.getActiveSpreadsheet();var s = ss.getSheetByName("BINDERY");var row = s.getRange('N:N').getDisplayValues();s.showRows(1, s.getMaxRows());for(var i=2; i< row.length; i++){ if(row[i] == 'FALSE') {s.hideRows(i+1, 1);}}}{var range = e.range;var col = range.getColumn();if (col === 1) {var spreadsheet = SpreadsheetApp.getActive();spreadsheet.getRange('1:1').activate();var currentCell = spreadsheet.getCurrentCell();var sheet = spreadsheet.getActiveSheet();sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns()).activate();currentCell.activateAsCurrentCell();spreadsheet.getActiveRange().offset(1, 0, spreadsheet.getActiveRange().getNumRows() - 1).sort([{column: 1, ascending: true}, {column: 2, ascending: true}]);};}}