Options

problems with RECORDREF

toniMtoniM Member Posts: 11
hi, I need help about using RECORDREF, from couple of hours I get one and the same error , my code is given below it iterates through the fields in the table opened by RecRef):
REPEAT
  IF RecRef.FIELDEXIST(nFields) = TRUE THEN BEGIN
   FldRef := RecRef.FIELDINDEX(nFields) ;
   Type:=  FORMAT(FldRef.TYPE) ;

        IF Type = 'Text' THEN
          Type := 'Text ' + FORMAT(FldRef.LENGTH) ;

        nRow := nRow+1 ;
  END ;
        nFields:= nFields+1 ;
UNTIL nFields > RecRef.FIELDCOUNT;


it works for tables which has Field No. 1,2,3 ...., but if one number is missing and fields are 1,2,6 as in Table No. 9 Customer for example I get error that the field No. 3 do not exist. I tried with:
FldRef := RecRef.FIELD(nFields) ;
but I get the same error.

[/code]

Comments

  • Options
    kinekine Member Posts: 12,562
    FIELDEXIST take Field No. (1,3,5,54100...), but FIELDINDEX take index (1,2,3..x)... :-) :idea:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.