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

How to avoid wrap in find method ?

Community Expert ,
Dec 14, 2016 Dec 14, 2016

Copy link to clipboard

Copied

Dear friends,

Although i carefully followed the advice found at this post, I have no success. The find always wraps back to the first occurrence fo the items to be found.

Case 3 works fine for several months now - but why does case 4 not?

Jang obviously had the same problem in the mentioned post ...

function GetFindParameters (iType, sSearch) {
var propVal, findParams = new PropVals() ; 

  switch (iType) {

// ...

    case 3: // ---------------------------------- find marker of type sSearch, don't wrap
      propVal = new PropVal() ; 
      propVal.propIdent.num = Constants.FS_FindWrap ; 
      propVal.propVal.valType = Constants.FT_Integer; 
      propVal.propVal.ival = 0 ;
      findParams.push(propVal); 
      propVal = new PropVal() ; 
      propVal.propIdent.num = Constants.FS_FindMarkerOfType; 
      propVal.propVal.valType = Constants.FT_String; 
      propVal.propVal.sval = sSearch; 
      findParams.push(propVal); 
      return findParams;
      break;

    case 4: // ---------------------------------- find character format sSearch, don't wrap
      propVal = new PropVal() ; 
      propVal.propIdent.num = Constants.FS_FindWrap ; 
      propVal.propVal.valType = Constants.FT_Integer; 
      propVal.propVal.ival = 0 ;
      findParams.push(propVal); 
      propVal.propIdent.num = Constants.FS_FindCharTag; 
      propVal.propVal.valType = Constants.FO_CharFmt; 
      propVal.propVal.sval = sSearch; 
      findParams.push(propVal); 
      return findParams;
      break;

    default:
      alert ("GetFindParameters:\nPgm error: case " + iType + " in switch not defined.", "GetFindParameters", true);
      return null;
  }
} //---  end GetFindParameters

Because of this my searches are not terminated and loop forever - FA_errno is not set (as described in the FDK doc).

  findRange = goCurrentDoc.Find  (oTextLoc, findParams);// finds text range (object pgf), lenght 1
  if (FA_errno === Constants.FE_NotFound) {
    return null;                                  // no further items
  }

What's wrong with my search parameters?

TOPICS
Scripting

Views

465

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

Enthusiast , Dec 14, 2016 Dec 14, 2016

Hi Klaus,

in case 4 you are overriding "propVal.propVal.valType" (line 21) with line 25.

I think you forgot "propVal = new PropVal() ; " Insert after line 23

Votes

Translate

Translate
Enthusiast ,
Dec 14, 2016 Dec 14, 2016

Copy link to clipboard

Copied

Hi Klaus,

in case 4 you are overriding "propVal.propVal.valType" (line 21) with line 25.

I think you forgot "propVal = new PropVal() ; " Insert after line 23

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 ,
Dec 14, 2016 Dec 14, 2016

Copy link to clipboard

Copied

LATEST

As usual: to close to the screen the overview is lost...

Thank You, Klaus!

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