How to display declining balance in field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Post by mwieder » Thu Oct 22, 2009 8:00 am

It's been a while since I've had to mess with VB, but from memory:

runrev:

Code: Select all

put "def" into field "t1"
put "abc" before field "t1"
put "xyz" after field "t1"
Visual Basic:

Code: Select all

t1.text = "def"
t1.text = "abc" + t1.text
t1.text = t1.text + "xyz"

urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Post by urbaud » Thu Oct 22, 2009 11:21 pm

Hi wimeir,

Thank you for reminding me of the VB code. It too has been awhile since I dabbled in VB. I believe the VB code is more an example of concatenation. As you well know Rev has the ability to have numbers, text and calculations all within a variable. I don't believe VB can do that. VB would have to have separate variables for numbers and text otherwise it would produce a datatype error.

As you know Rev can do this:

Code: Select all

on mouseUp
   put 1 into container
   put 3 after container
   put e after container
   put 3+1 after container
   put "dan" before container
   put "XZ" after char 5 in container
   put 4*5 after container
   put "   " after char 6 in container
   put container into fld "l1"
end mouseUp
Output: dan13X   Ze420
I have found the discussion about my declining balance problem and subsequent chunk expression discussion most helpful. I feel much more confident and knowledgeable about chunk expressions. I really appreciate your comments and suggestions. Also, if Andrew is reading this, thanks Andrew for your input.

Best Regards, Dan
urbaud

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Post by mwieder » Fri Oct 23, 2009 1:10 am

Dan-

You ain't seen nothing yet.

Try something like

Code: Select all

replace "Ze" with the quote & short name of me & quote in container
I used to think that, despite its drawbacks, Basic's main strength lay in string manipulation. But you really have to go way out of your way to code things in Basic that are powerful one-liners in rev: things like the replace function, substring management, the merge function, etc.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Post by mwieder » Fri Oct 23, 2009 1:13 am

...and by the way, the "sort field t1 descending" line was supposed to be applied *after* your original loop put things into the "wrong" order. A simple sort statement sets things aright afterwards...

Post Reply