>> Is there any way to get index field of table, and know its type, primany or regular? <<
Check out KEY(), CANDIDATE(), PRIMARY() in the on-line help.
Since you need the number of the index tag in the KEY() function, you will need to write a little UDF to get it if you know the name of the tag. This should get you started. It is not guaranteed to work as is since it is off the top of my head and not tested < s >.
LOCAL lcTagName, lnCnt
lcTagName = ORDER()
IF ! EMPTY( lcTagName )
FOR lnCnt = 1 TO TAGCOUNT()
IF UPPER( TAG ( lnCnt ) ) = lcTagName
EXIT
ENDIF
ENDFOR
? KEY ( lnCnt )
ENDIF
Marcia