INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

New to JS. Working with it in goog

New to JS. Working with it in goog

(OP)
New to JS. Working with it in google sheets. For some reason, i can't get the nested if to filter out at the bottom. code is not finished. the log is at the very bottom. it should only log 4 times. Please tell me that JS in Google sheets is not that flaky.


CODE --> javascript

function loopsearch(){
  //looking for 'find me'
  var app = SpreadsheetApp;
  var str = "Team Name:";
  var strcell = "";
  var icount = 0; //counts number of team name instances in column A of Breakdown sheet
  var irowstart = 0;//starting row # for personnel names in team
  var inamecount = 0;//number of names for a team
  var i2 = 0;
  var i3 = 0;
  Logger.clear();
  //files will be built one team at a time then irowstart and inamecount will be reset
  //  Logger.log("Start here");
  //active sheet
  var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
  
  
//loop will add 5 to cell with existing values   
  for(var i=1;i<1000;i++){
  var sCell = activeSheet.getRange(i+0,1).getValue();

  strcell = sCell;
  i2 = strcell.indexOf("Team")>=0;
  
//  Logger.log("i2 = "+ i2);
  if (strcell);{
    if (strcell.indexOf("Team")>=0);
    { 
        icount++;
        Logger.log(i2+"  "+true);
        
        irowstart = icount;

   //     Logger.log("inside if 2 = " + icount);
     }
     }
    }
  } 

[17-10-30 17:05:01:659 EDT] false true
[17-10-30 17:05:01:661 EDT] false true
[17-10-30 17:05:01:663 EDT] false true
[17-10-30 17:05:01:665 EDT] true true
[17-10-30 17:05:01:667 EDT] false true
[17-10-30 17:05:01:669 EDT] false true
[17-10-30 17:05:01:670 EDT] false true
[17-10-30 17:05:01:672 EDT] false true
[17-10-30 17:05:01:674 EDT] false true
[17-10-30 17:05:01:676 EDT] false true
[17-10-30 17:05:01:677 EDT] false true
[17-10-30 17:05:01:679 EDT] false true
[17-10-30 17:05:01:680 EDT] false true
[17-10-30 17:05:01:682 EDT] false true
[17-10-30 17:05:01:683 EDT] false true
[17-10-30 17:05:01:685 EDT] false true
[17-10-30 17:05:01:687 EDT] false true
[17-10-30 17:05:01:689 EDT] false true
[17-10-30 17:05:01:691 EDT] false true
[17-10-30 17:05:01:692 EDT] false tru

RE: New to JS. Working with it in goog

(OP)
This line

if (strcell.indexOf("Team")>=0);

didn't work, tried:
i2 = strcell.indexOf("Team")>=0;
if (i2==true);

Same log

Thank you for your help.

RE: New to JS. Working with it in goog

I got it. Took the ';' off the if(); condition area.

Greg

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close