That was quite dense, and I would split up the RETURN line for readability. < g > Plus your results can be defeated by the actual value in the field. In the Invoices table in the NW DBC, I get no decimals using TRANSFORM() on the discount field regardless of the overall value of the field unless at least one of the decimal places has at least 1 non-zero value.
>Hi Chuck.
>
>>Is there a function that will return how many decimal places a numberic field has?
>
>If the table is open, you could use something like (where FIELDNAME is the name of the field):
lcValue = transform(FIELDNAME)
>lnPlace = at('.', lcValue)
>lnLen = len((lcValue)
>lnDecimals = iif(lnPlace = 0, 0, lnLen - lnPlace)
This is actually more code than using Mark's suggestion of AFIELDS, which can be reduced to the admittedly dense {g}:
afields(laFields)
>lnDecimals = laFields[ascan(laFields, 'FIELDNAME', -1, -1, 1, 15), 4]
Doug
Mark McCasland
Midlothian, TX USA