FIELDEDIT()

 

Syntax:

Then: xx = FIELDEDIT(lookupname,fieldno)

"lookupname" is the name of the lookup file. Use a dash "-" to represent the current file.
"fieldno" is an expression designating the field number for which you want the edit type.

Return value is a text field containing the name of the target field's edit type.

 

Version Ref:  4.5

Description:

Returns the name of the edit for the specified field in a lookup file.

 

Examples:

Retrieves the edit type of a lookup field and places it in variable aa.

       Then: lookup inv=arinvoice k=2 i=a -nx
       Then: aa=fieldedit(inv,"5")

Assigns an edit to a field based on the edit type of a lookup field.

       Then: lookup inv=arinvoice k=2 i=a -nx
       Then: aa(10,fieldedit(inv,"5"))

The following code uses other filePro field functions to display the "map" of a lookup file. It displays the field names, lengths, and edit types in a listbox that looks similar to an actual map printout. (Assumes the lookup name is "file".)

       Then: dim map(100)(60,*)
       Then: no(3,.0) = "1"
         If: numfield(file) eq "0"
       Then: errorbox "No fields" ; end
loop     If: no gt numfield(file) or no gt "99"
       Then: goto done
       Then: map[no] = no & " - " &
             doedit(fieldname(file,no),"*","45") & " " &
             doedit(fieldlen(file,no),".0","3") <
             fieldedit(file,no)
       Then: no = no + "1" ; goto loop
done     If:
       Then: aa = listbox(map,"1",no-"1")

Note the use of the DOEDIT() function while building the map entry. This guarantees that all entries will be of the same length, and the columns will be aligned.