Page 1 of 1

script edit return constant

Posted: Mon Jan 16, 2012 9:32 am
by elagattolla
What is the proper grammar for entering a return constant line break? I am trying to enter variables into a field. I want one line followed by another, therefore it seems return is what I am looking for. I am trying to illustrate the greatest common divisor algorithm. This is what I have so far:
put 673 into m
put 12 into n
--673 and 12 could be any numbers
put m & comma & n into field "Field"
--I want 673,12 to be displayed so the users know what numbers we are finding the greatest common divisor of
put return after item 2 of field "Field"
--so this is the part that is wrong. Whatever I put next just replaces the 673,12 instead of being on the next line.
--then I want to do m mod n to find the remainder and proceed with the algorithm

I hope I explained my issue correctly. Thanks a bunch.

Re: script edit return constant

Posted: Mon Jan 16, 2012 11:22 am
by Mark
Hi,

So, where's the syntax that "puts next"? In the syntax you posted, I see no mistakes.

Kind regards,

Mark

Re: script edit return constant

Posted: Mon Jan 16, 2012 3:47 pm
by kdjanz
I think what you want to do is to now

Code: Select all

put return AFTER field 1
...
put divisor & return after field 1
After will put it at the end of the field and create a new line, then you can display your divisor on the next line and continue on that way.

Hope I'm understanding correctly,

Kelly

Re: script edit return constant

Posted: Mon Jan 16, 2012 4:01 pm
by sturgis
If you start with an empty field

put empty into field "myfield"

Then want to cycle through a bunch of numbers and build up a sequence of lines use the "after" form of put as mentioned above.

put m & comma & n & return after field "myField"


This way it will append whatever you are 'put'ting AFTER the end of the field.

Then when done putting all your lines in you'll want to "delete the last char of field "myField" to get rid of the dangling return.

Another method would be to ignore the field while processing is done and build your list of lines in a variable.

put m & comma & n & return into tMyTempVariable


When done processing all your numbers,
delete the last char of tMyTempVariable
put tMyTempVariable into field "myField" -- since we're wanting to put the whole contents of the variable into the field intact, use into rather than after

If there will be lots of lines and processing to be done, using a temp variable to hold the work in progress will be faster than working directly with the field.

Re: script edit return constant

Posted: Mon Jan 16, 2012 10:28 pm
by elagattolla
Many thanks for the insight!