View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
FoxWeb uses the following code to convert numeric values within merge delimiters to strings:

IF M.vInput = 0
  RETURN '0'
ELSE
  LOCAL StrNum, StrExp
  StrNum = LTRIM(STR(M.vInput, 25, 18))
  IF 'E' $ M.StrNum
    StrExp = SUBSTR(M.StrNum, RAT('E', M.StrNum))
    StrNum = LEFT(M.StrNum, RAT('E', M.StrNum) - 1)
  ELSE
    StrExp = ''
  ENDIF
  IF '.' $ M.StrNum
    * Strip zeros past the decimal point
    DO WHILE RIGHT(M.StrNum, 1) == '0'
      StrNum = LEFT(M.StrNum, LEN(M.StrNum) - 1)
    ENDDO
    * Strip decimal point if it is at the end
    IF RIGHT(M.StrNum, 1) == '.'
      StrNum = LEFT(M.StrNum, LEN(M.StrNum) - 1)
    ENDIF
  ENDIF
  RETURN M.StrNum + M.StrExp
ENDIF

If the above code is not adequate for your needs then you should use your own algorithm to do the conversion, e.g.:

<%=LTRIM(STR(table.numeric, 10, 2))%>

FoxWeb Support Team
support@foxweb.com


Sent by mike hood on 01/23/2002 09:24:50 AM:
when i display a numeric field from a table <%=table.numeric%> into the body of the html.  the results on the form dont display the exact table value.
example: table==3.00 // html == 3
             table==3.17 // html ==3.169999999999

++ in fox using the str command with truncate the .00 also

how do u get the html to display the tables exact values.