Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - TypeError: " is undefined "
  FAQ FAQ  Forum Search   Register Register  Login Login


Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

TypeError: " is undefined "

 Post Reply Post Reply
Author
lindaelise View Drop Down
New Member
New Member


Joined: 26 Mar 2014
Points: 19
Post Options Post Options   Quote lindaelise Quote  Post ReplyReply Direct Link To This Post Topic: TypeError: " is undefined "
    Posted: 07 Feb 2015 at 11:34pm

Hello,

 

I am getting the following error:

 

TypeError: global.srchVals[PMItms[j]] is undefined

 

 

The code is failing at this line:

 

 

global.srchVals[PMItms[j]].srchPgs = PMPgs;

 

 

 

Here is more of the code up to the point where it fails:

 

 

function subSrchValPM() {

    var srchThisStr = "";
  srchThisStr = this.getField(1).valueAsString;
var srchThisArr = srchThisStr.replace(/\s/g,"").split(",");
var nNumWords = srchThisArr.length;
var myArr = [];  //var myArr = new Array();
for(i = 0; i <= nNumWords; i++){  //for (var i in srchThisArr)
       myArr.push("" + srchThisArr);
    //return myArr;
   }


global.srchVals = [{}]
for (i = 0; i<= nNumWords; i++) {
  global.srchVals = {srchTrm: trim(""+myArr).valueAsString, mode: 0, results: []}; //

}
 

// Payor Mix
var PMAddItms = "";
var PMLstItms = "";
for (var i=1; i<= nNumWords; i++) {
      global.srchVals.name = "Payor Mix";
   global.srchVals.mode = 0;

  PMAddItms = i;
  
   if (i < nNumWords) {
   PMLstItms = PMLstItms + PMAddItms + ",";
  } else {
   PMLstItms = PMLstItms + PMAddItms;
  }


 
}
  var PMItms = [PMLstItms];
 


for (var i in global.srchVals) {
  global.srchVals.srchPgs = [];
  global.srchVals.matchTerm = getMatchTerm(global.srchVals.srchTrm, global.srchVals.mode);
}
 
this.closeDoc(true);

var t = app.thermometer;
t.begin();

t.text = "Processing bookmarks...";
var PMPgs = [];
for (var i=0; i<global.mainDoc.bookmarkRoot.children.length; i++) {
  if (global.mainDoc.bookmarkRoot.children.name.indexOf("Payor Mix")!=-1)  {
   PMPgs = getBookmarkRange(global.mainDoc, global.mainDoc.bookmarkRoot, i); 
   //PMPgs = PMPgs.slice(PMPgs.length -1);  // Use first page of the bookmark
   for (var j in PMItms)
    global.srchVals[PMItms[j]].srchPgs = PMPgs;  // Here is where the error happens
  }
}

 

....... the rest of the code ......

 

 

 

 

}

 

Why am I getting an "is undefined" error?

 

Thanks

 

Linda

Back to Top
Sponsored Links


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.023 seconds.