• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Again: undefined is not an object ...

Community Expert ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Dear friends, I may be blind again - there was ample sunshine today...

In this snippet

if (oTR.beg.obj.ObjectValid()) {
$.writeln(oTR.beg.obj.constructor.name);
  oFound.object = oTR.beg.obj; 

At line 3 I get the error "undefined is not an object".

Line 2 outputs Pfg - so imho "oTR.beg.obj" is an object.

oFound is declared to be an object, as well as oTR is.

Where is my knot in t he brain?

 

TOPICS
Scripting

Views

178

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Jun 08, 2022 Jun 08, 2022

Try this:
oFound.myObject = oTR.beg.obj;

It might be that the 'object' property conflicts with a reserved keyword in the scripting environment or language. So the error refers to the property you are trying to set, not the value you try to assign to it. 

Votes

Translate

Translate
Advocate ,
Jun 08, 2022 Jun 08, 2022

Copy link to clipboard

Copied

Try this:
oFound.myObject = oTR.beg.obj;

It might be that the 'object' property conflicts with a reserved keyword in the scripting environment or language. So the error refers to the property you are trying to set, not the value you try to assign to it. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2022 Jun 09, 2022

Copy link to clipboard

Copied

LATEST

Jang, you hit the nail! I should not have used here a propertyat all, because oFound is already used as the found object (Pgf etc.). And somewhere I have noted to avoid private property names resebling existing ones...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines