Re: Programing style

2006-11-19 Thread Dave Cragg
On 17 Nov 2006, at 16:51, Tereza Snyder wrote: On Nov 17, 2006, at 12:43 AM, Dar Scott wrote: The syntax identifies properties, so why give them a special prefix? I use u before my custom property names to distinguish them from built-in properties for several reasons. First, I won't

Re: Programing style

2006-11-19 Thread Eric Chatonet
Hi all, I am used to put a u before custom properties names. As I put a t before local variables, a g before globals, etc. And always use meaningful words: on SetOtherUsersList pCurUserNo local tOtherUsersList - put AllUsersList() into tOtherUsersList -- delete item pCurUserNo of

Re: Programing style

2006-11-19 Thread Mark Wieder
Eric- Sunday, November 19, 2006, 3:33:31 AM, you wrote: I am used to put a u before custom properties names. As I put a t before local variables, a g before globals, etc. That's the convention I use as well, ala Richard's writeup. By placing a t before the local variables I can instantly tell

Re: Programing style

2006-11-17 Thread Mark Wieder
Ken- Thursday, November 16, 2006, 8:54:11 PM, you wrote: FUNCTION fNumericToMoney pNumeric local tMoney local x -- leading dollar sign and two digits for cents put format($%.2f, pNumeric) into tMoney -- add the commas as necessary -- 4 is to ensure we don't

Re: Programing style

2006-11-17 Thread Tereza Snyder
On Nov 17, 2006, at 12:43 AM, Dar Scott wrote: The syntax identifies properties, so why give them a special prefix? I use u before my custom property names to distinguish them from built-in properties for several reasons. First, I won't be bollixed when new properties are added to the

Programing style

2006-11-16 Thread Hershel Fisch
Hi all, I'd like to know how others write a function like this. TIA Hershel function fNumericToMoney put param(1) into tParam if tParam contains . then put offSet(.,tParam)-1 into tTs put 3 into tC else put the number of chars in tParam into tTs put 0 into tC end if

Re: Programing style

2006-11-16 Thread Dar Scott
On Nov 16, 2006, at 2:01 PM, Hershel Fisch wrote: Hi all, I'd like to know how others write a function like this. That looks pretty good. As far as style, I'd only do a couple things differently. First I'd use a parameter name like this function fNumericToMoney n or this function

Re: Programing style

2006-11-16 Thread John Craig
The format function may be worth a look at in the docs; put $ format(%1.3f, 12345.678) into tResult would format to 3 decimal places. If you are after the thousand seperators, I don't think format can do that, but I could be wrong. Here's a snippet that will format with the thousand

Re: Programing style

2006-11-16 Thread Jim Ault
--takes advantage of Rev parsing --does not handle negative numbers function fNumericToMoney put param(1) into tParam set itemdel to . put item 1 of tParam into newNum set the lineDel to , repeat until char 1 of newNum is , put , before char -3 of line 1 of newNum end repeat put $

Re: Programing style

2006-11-16 Thread Jim Ault
Forgot to ask about final format ? two decimals ? Add one line at the end to handle this 'if there are no decimals' On 11/16/06 2:00 PM, Jim Ault [EMAIL PROTECTED] wrote: --takes advantage of Rev parsing --does not handle negative numbers function fNumericToMoney put param(1) into tParam

Re: Programing style

2006-11-16 Thread Hershel Fisch
On 11/16/06 4:58 PM, John Craig [EMAIL PROTECTED] wrote: Here's a snippet that will format with the thousand seperators; put 12345678.567 into tVal set itemDel to . put item 1 of tVal into tInt put . item 2 of tVal into tDec repeat with i = length(tInt) - 3 to 1 step -3 if i 0 then put

Re: Programing style

2006-11-16 Thread Hershel Fisch
On 11/16/06 5:06 PM, Jim Ault [EMAIL PROTECTED] wrote: Forgot to ask about final format ? two decimals ? Yes, but I don't understand your code. Add one line at the end to handle this 'if there are no decimals' On 11/16/06 2:00 PM, Jim Ault [EMAIL PROTECTED] wrote: --takes advantage of

Re: Programing style

2006-11-16 Thread Dar Scott
This would be a short and maybe elegant solution, except it doesn't work: function fNumericToMoney d set the numberFormat to $,.00 return (d+0) empty -- force use of numberFormat end fNumericToMoney The dollar and comma are converted to zeros. (I think I misunderstood your question

Re: Programing style

2006-11-16 Thread Sarah Reichelt
On 11/17/06, Hershel Fisch [EMAIL PROTECTED] wrote: Hi all, I'd like to know how others write a function like this. TIA Hershel function fNumericToMoney put param(1) into tParam if tParam contains . then put offSet(.,tParam)-1 into tTs put 3 into tC else put the number of

Re: Programing style

2006-11-16 Thread John Craig
Say we have a 10 digit number called tInt - 1234567890 repeat with i = length(tInt) - 3 to 1 step -3 We start at length(tInt) - 3 (position 7) and put a comma after the character at position 7 This gives us 1234567,890 The next iteration (-3) takes us to position 4 - put in another comma;

Re: Programing style

2006-11-16 Thread Hershel Fisch
On 11/16/06 6:59 PM, Sarah Reichelt [EMAIL PROTECTED] wrote: Also, you need to check that the number doesn't already contain any commas or dollar signs, so replace them with empty before you start. Then add a check for the parameter actually being a number. Thanks. I have a separate

Re: Programing style

2006-11-16 Thread Hershel Fisch
On 11/16/06 6:53 PM, Dar Scott [EMAIL PROTECTED] wrote: This would be a short and maybe elegant solution, except it doesn't work: function fNumericToMoney d set the numberFormat to $,.00 return (d+0) empty -- force use of numberFormat end fNumericToMoney The dollar and comma are

Re: Programing style

2006-11-16 Thread Hershel Fisch
On 11/16/06 7:10 PM, John Craig [EMAIL PROTECTED] wrote: Say we have a 10 digit number called tInt - 1234567890 repeat with i = length(tInt) - 3 to 1 step -3 I got it, a reverse repeat by 3. I was wondering for a while how to do a reverse repeat, I got it. Thanks. Hershel We start at

Re: Programing style

2006-11-16 Thread Jim Ault
On 11/16/06 3:37 PM, Hershel Fisch [EMAIL PROTECTED] wrote: On 11/16/06 5:06 PM, Jim Ault [EMAIL PROTECTED] wrote: Forgot to ask about final format ? two decimals ? Yes, but I don't understand your code. full text is below Basically you are using the Rev definition of item and line to

Re: Programing style

2006-11-16 Thread Ken Ray
On 11/16/06 3:01 PM, Hershel Fisch [EMAIL PROTECTED] wrote: Hi all, I'd like to know how others write a function like this. TIA Hershel function fNumericToMoney put param(1) into tParam if tParam contains . then put offSet(.,tParam)-1 into tTs put 3 into tC else put

Re: Programing style

2006-11-16 Thread Mark Wieder
Hershel- Thursday, November 16, 2006, 1:01:34 PM, you wrote: Hi all, I'd like to know how others write a function like this. O... a challenge. First of all, I'd add some comments. Then here's what I came up with - rather like John Craig's repeat loop. Not sure how you'd want negative

Re: Programing style

2006-11-16 Thread Ken Ray
On 11/16/06 8:58 PM, Mark Wieder [EMAIL PROTECTED] wrote: Hershel- Thursday, November 16, 2006, 1:01:34 PM, you wrote: Hi all, I'd like to know how others write a function like this. O... a challenge. First of all, I'd add some comments. Then here's what I came up with - rather

Re: Programing style

2006-11-16 Thread Dar Scott
On Nov 16, 2006, at 5:33 PM, Hershel Fisch wrote: by the way what did you by prefix? I am contrarian in the use of certain letters at the start of names to help with readability among team members. (When a customer has style requirements, I follow those, but for my own work, I use other