Ask a Question

ReferenceError: recordToObject is not defined

Adagio
Frequent Contributor

ReferenceError: recordToObject is not defined

Hello,

 

I'm using this code to fetch the DB Table data into an array, but just today I started getting this error:

"ReferenceError: recordToObject is not defined"

 

Could some one please help me understand what's the issue here?

 

//execute a query
var set = conn.Execute_(execQuery);
//declare an array 
var DBlist  = new Array();;

  if(set.EOF == false){
  set.MoveFirst();
  while(! set.EOF)
  {
    //Log.Message(set.Fields)
    DBlist.push(recordToObject(set));
    set.MoveNext();
  }
  Log.Message(DBlist.length);
  Log.Message(DBlist[0]);
  conn.Close();
  return DBlist;
  
  }else{
    Log.Message("No Records Found in the DB");
    //Closing the connection
    conn.Close(); 
    return false;
  }

 

Any help would be appreciated!

 

Thank you

Abhi

4 REPLIES 4
tristaanogre
Esteemed Contributor

What is "recordToObject"? It's a method/function call you're making but there's nothing in what you posted to tell us about it.

 

Generally, the error you reported is that the JavaScript engine is trying to find the function to execute but can't because, for some reason, it's not in scope for what you have referenced.

 

Is it a function in a different script unit? Is it a function in the same script unit? Where is it defined and how? 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cunderw
Community Hero

recordToObject sounds like something that I wrote as a utility and shared on here (can't find the original post).

 

Perhaps you saw my example and assumed this was a built in utility to Test Complete?


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
tristaanogre
Esteemed Contributor

Yup, here it is.

https://community.smartbear.com/t5/TestComplete-General-Discussions/how-to-get-DB-table-into-a-2D-ar...

 

So, if you have recordToObject in one script unit and are trying to use it in a different one, you need to make sure you tell the script Engine of TestComplete where to find the script.  Reference https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/...



Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Adagio
Frequent Contributor

@cunderw..you are right. but that had been working well for a while now, because that's part of the main routine which I call from other scripts and return a table array. Only today, I've encountered this kind of problem. I'm not able to understand what's different this time. I'll dig more to figure it out.

 

Thank you

Abhi

cancel
Showing results for 
Search instead for 
Did you mean: