Re: Scripting what should be a simple loop...

2010-07-12 Thread Bob Sneidar
In this particular case you are correct. And I also agree that naming fields (or variables or any objects) using a reserved word is a bad idea. Bob On Jul 9, 2010, at 4:49 PM, Mark Schonewille wrote: HI BOB, It doesn't matter, because David writes he got only 10 fields in that group.

Re: Scripting what should be a simple loop...

2010-07-12 Thread Richmond
On 07/12/2010 06:53 PM, Bob Sneidar wrote: In this particular case you are correct. And I also agree that naming fields (or variables or any objects) using a reserved word is a bad idea. And this is where I jump right back in and state that a naming convention avoids the temptation to use

Re: Scripting what should be a simple loop...

2010-07-12 Thread Bob Sneidar
Just one gotcha with the repeat for each construct. Do NOT under any circumstances change the contents of the source variable inside the repeat loop. For instance: repeat for each line tLine in myListOfLines Do NOT change the contents of myListOfLines inside your repeat loop. It was explained

Re: Scripting what should be a simple loop...

2010-07-12 Thread Bob Sneidar
By some odd coincidence those are the names of the first 4 buttons in my new project! Bob On Jul 12, 2010, at 9:04 AM, Richmond wrote: On 07/12/2010 06:53 PM, Bob Sneidar wrote: In this particular case you are correct. And I also agree that naming fields (or variables or any objects)

Re: Scripting what should be a simple loop...

2010-07-10 Thread Kay C Lan
On Sat, Jul 10, 2010 at 11:37 AM, David C. davidoco...@gmail.com wrote: Column1--corresponds to-Field1--corresponds to---tVar1-- is used by. etc Of course there's no reason you couldn't col1 - original data fCol1 - field lfCol1 - label field bCol1 - button tCol1 - temp var lCol1 -

Re: Scripting what should be a simple loop...

2010-07-10 Thread Richmond
On 07/10/2010 02:23 AM, David C. wrote: Good grief! Will someone be so kind as to show me the proper way to format my script... 'the proper way . . . Um; that is slightly funny as, unlike Fortran IV (what a pain it was) there is no strict set of rules as to how to format a script. This

Re: Scripting what should be a simple loop...

2010-07-10 Thread Mark Schonewille
David and Mark, Yet, repeat for each rules. Whether using arrays is faster than using regular variables depends on whether your repeat loop is written smartly. -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com

Re: Scripting what should be a simple loop...

2010-07-10 Thread René Micout
Hello Bob, Sarah, Mark, Alex, Scott, Kay, Very good lesson !!! Yes ! Better than documentation ! It is a good example for witch I appreciate How to use Revolution I imagine that many silent readers appreciate like me and I thank you on their behalf... PS : pity not have English lessons like that

Re: Scripting what should be a simple loop...

2010-07-10 Thread Richmond
On 07/10/2010 11:49 AM, Mark Schonewille wrote: David and Mark, Yet, repeat for each rules. Whether using arrays is faster than using regular variables depends on whether your repeat loop is written smartly. Quite; but that looks a bit like circular logic. Everytime I have to write some

Re: Scripting what should be a simple loop...

2010-07-10 Thread René Micout
I like Richmond's disillusioned vision of life ! ;-) René Le 10 juil. 2010 à 10:45, Richmond a écrit : On 07/10/2010 02:23 AM, David C. wrote: Good grief! Will someone be so kind as to show me the proper way to format my script... 'the proper way . . . Um; that is slightly funny as,

Re: Scripting what should be a simple loop...

2010-07-10 Thread zryip theSlug
Richmond, I'm not sure to appreciated your humor. However, with less talent and other circumstances, I had probably write something similar somewhere in the net, so I forgive you for this time. 2010/7/10 Richmond richmondmathew...@gmail.com On 07/10/2010 11:49 AM, Mark Schonewille wrote:

Re: Scripting what should be a simple loop...

2010-07-10 Thread David C.
Column1--corresponds to-Field1--corresponds to---tVar1-- is used by. etc Of course there's no reason you couldn't col1 - original data fCol1 - field lfCol1 - label field bCol1 - button tCol1 - temp var lCol1 - script local var gCol1 - global var cCol1 - custom prop makes the

Re: Scripting what should be a simple loop...

2010-07-10 Thread Richmond
On 07/10/2010 12:52 PM, zryip theSlug wrote: Richmond, I'm not sure to appreciated your humor. However, with less talent and other circumstances, I had probably write something similar somewhere in the net, so I forgive you for this time. 2010/7/10 Richmondrichmondmathew...@gmail.com On

Re: Scripting what should be a simple loop...

2010-07-10 Thread Richmond
On 07/10/2010 01:00 PM, David C. wrote: Column1--corresponds to-Field1--corresponds to---tVar1-- is used by. etc Of course there's no reason you couldn't col1 - original data fCol1 - field lfCol1 - label field bCol1 - button tCol1 - temp var lCol1 - script local var gCol1 -

Re: Scripting what should be a simple loop...

2010-07-10 Thread David C.
In regard to my question about using arrays, Mark W. said: Well, it's not regular variables that are the issue here. An array is *MUCH* faster than a do statement. Do statements are very slow, and I only use them sparingly and when there's no alternative. But when you gotta, you gotta. In this

Re: Scripting what should be a simple loop...

2010-07-10 Thread J. Landman Gay
Richmond wrote: However, when I tried to run the script it threw a bluey and opened the script editor in that rather unhelpful way where it marks the problem but doesn't allow you to edit it. It's opening in debug mode, which I find to be one of the most helpful features of the script

Re: Scripting what should be a simple loop...

2010-07-10 Thread zryip theSlug
Hum, I understand now why I have not found your post funny (or not). It's like a flashback. 2010/7/10 Richmond richmondmathew...@gmail.com On 07/10/2010 12:52 PM, zryip theSlug wrote: Richmond, I'm not sure to appreciated your humor. However, with less talent and other circumstances, I had

Re: Scripting what should be a simple loop...

2010-07-10 Thread Richmond
On 07/10/2010 08:27 PM, J. Landman Gay wrote: Richmond wrote: However, when I tried to run the script it threw a bluey and opened the script editor in that rather unhelpful way where it marks the problem but doesn't allow you to edit it. It's opening in debug mode, which I find to be one

Scripting what should be a simple loop...

2010-07-09 Thread David C.
Good grief! Will someone be so kind as to show me the proper way to format my script... Let's say I have the following 1 group named AllFields containing: 10 text fields, named Field1...Field10 10 temporary variables named tVar1...tVar10 All I want to do, using a loop, is to put the user

Re: Scripting what should be a simple loop...

2010-07-09 Thread Bob Sneidar
You need a do statement. Otherwise you would need Macro Substitution which Runrev does not support. put put fld quote Field i quote of group quote AllFields quote into tvar i into theCommand do theCommand -- careful of line wraps Easier to read is: put put fld fieldi of group

Re: Scripting what should be a simple loop...

2010-07-09 Thread Sarah Reichelt
Setting variables whose names are construct dynamically requires using do. So this should work: put Field i into tFieldName put put fld tFieldName of grp AllFields into tVar i into tCommand do tCommand Probably an easier solution is to use an array: put fld Field i of grp AllFields into

Re: Scripting what should be a simple loop...

2010-07-09 Thread Mark Schonewille
Hi David, Whenever you discuss something that involved an error, you really should post the error message together with your question. It helps. Really, it does. Now to your answer. I am not exactly sure what to answer, because I don't know the error message, but I can make a guess. It

Re: Scripting what should be a simple loop...

2010-07-09 Thread Bob Sneidar
As an aside, what Macro Substitution would be able to do is dereference variables at runtime. Assuming an amperstand was the dereference character: put field into theObject put tVar into theVar put 1 into i put field theObject.i of group AllFields into theVar.i This was how dBase and other dev

Re: Scripting what should be a simple loop...

2010-07-09 Thread Alex Tweedly
You do indeed need a 'do' statement - but the first half of the statement (dealing with the field) doesn't need it, only the second half. So I would find it more readable to do put (fld field i) into temp do put temp into quote tVar quote i OK, it's marginally inefficient, but who

Re: Scripting what should be a simple loop...

2010-07-09 Thread Scott Rossi
Hi David: One way to dynamically create a variable on the fly is using the do command. repeat with i = 1 to 10 get fld (Field i) of grp Allfields -- put the value into it do put it into tVar i end repeat Two additional things to consider: 1) When referring to an object name

Re: Scripting what should be a simple loop...

2010-07-09 Thread Bob Sneidar
Hi Mark. That won't work because the fields themselves are named Field1 Field2. He is not referencing the fields by their numbers but rather by their names. A bit confusing but I got it. Bob On Jul 9, 2010, at 4:37 PM, Mark Schonewille wrote: Hi David, Whenever you discuss something

Re: Scripting what should be a simple loop...

2010-07-09 Thread Mark Schonewille
HI BOB, It doesn't matter, because David writes he got only 10 fields in that group. Besides, it is really a bad idea to call a field field 1. -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter:

Re: Scripting what should be a simple loop...

2010-07-09 Thread Alex Tweedly
On 10/07/2010 00:43, Alex Tweedly wrote: put (fld field i) into temp do put temp into quote tVar quote i Sorry - it doesn't need to be that complicated. you can just do put (fld field i) into temp do put temp into tVar i (And just in case there are more silly typos -

Re: Scripting what should be a simple loop...

2010-07-09 Thread David C.
Well, I guess that problem kind of opened up a can of worms... to which this reply is pointed to *all* who contributed. Thank you so much for the help! It's really appreciated. Let me digest some of the replies and I'll be back a bit later with a question or two. That should help clarify some

Re: Scripting what should be a simple loop...

2010-07-09 Thread David C.
Hey folks, I've tried to keep this to less than small book scale, but here we go... Bob, Sarah, Alex all concurred in one form or another that: Setting variables whose names are construct dynamically requires using do. Got it! ...the missing link. :) To be honest, I never really even considered

Re: Scripting what should be a simple loop...

2010-07-09 Thread Mark Wieder
David- Friday, July 9, 2010, 8:37:44 PM, you wrote: It is recommendable to use arrays in this case: repeat for i = 1 to 10 put fld i of grp AllFields into tVar[i] end repeat I'll really consider that to see if it will fit the need, Mark. Question: Is getting data into or out of an array any