2 Replies Latest reply on Dec 14, 2016 6:53 AM by K.Daube

    How to avoid wrap in find method ?

    K.Daube Level 1

      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?