This is not an answer to your question (you already got some answers). I never use alltrim() in a cursor because it will set the length of that column to the first record/field that is set. In other words, if you have a number 10 in the 1st record, that field will be 2 characters. Then, in the next record, you have a number 1000, it will only have 2 characters in which to be stored.
----- Original Message ----- From: "MB Software Solutions" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, December 24, 2007 9:36 AM Subject: Re: Need tip on TRANSFORM (solved with UDF) MB Software Solutions wrote: >>> inserts values into the numeric field, and the character fields >>> DEFAULT >>> value settings transform the numbers into their character equivalents. >>> I had been using something like this: >>> >>> CREATE CURSOR curReport(nValue n(10,2), cValue c(10) DEFAULT >>> ALLTRIM(STR(nValue,10,liDecimals))) >>> >>> ...where liDecimals is a value set at run time depending on the amount >>> of decimal places I need for that record insert. In my testing I know >>> that TRANSFORM would be great like this: >>> >>> TRANSFORM(nValue,'999,999.99') >>> >>> ...but sometimes I don't want the character representation to have the >>> same number of decimal positions. My plan B is to create some rigged >>> UDF whereby I pass the value and the number of decimals places I want >>> and it parses/builds it for me, but that seems kludgey. Is there a >>> way >>> to get the transform to behave variably like I had in my initial >>> DEFAULT >>> value with ALLTRIM(STR(..)) without a UDF ?? >>> This was what I came up with (method: FormatNumber) LPARAMETERS tnValue, tiDecimals LOCAL lcValue as String, lcExpr as String lcExpr = '999,999' if tiDecimals > 0 then lcExpr = lcExpr + '.' + REPLICATE('9',tiDecimals) endif lcValue = ALLTRIM(TRANSFORM(tnValue,lcExpr)) return lcValue -- Michael J. Babcock, MCP MB Software Solutions, LLC http://mbsoftwaresolutions.com http://fabmate.com "Work smarter, not harder, with MBSS custom software solutions!" [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

