Displaying in the next line of a field

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kylelawson6
Posts: 2
Joined: Tue Feb 24, 2015 10:54 am

Displaying in the next line of a field

Post by kylelawson6 » Tue Feb 24, 2015 11:05 am

How would one display data from a linear search of an array finding values greater than a specified value, in the next line of a field without having gaps in the field?

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying in the next line of a field

Post by Klaus » Tue Feb 24, 2015 1:25 pm

Hi Kyle,

1. hello and welcome to the forum! :D
2. You can e.g.:
...
put CR & the_new_line after fld "xyz"
...
3. Please check these great stacks to get more of the very basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Displaying in the next line of a field

Post by dunbarx » Tue Feb 24, 2015 6:58 pm

Hi.

Did you really mean "array", which is a very specific concept in LC, or did you just mean a set of data?

If really an array, you will need to first convert into ordinary data. In either case, we can start to talk about your question. I think.

Did you mean you have a list of numbers? Or perhaps a data set that contains an index of some sort, Like:
1,Tom
2,Dick
3,Harry
It is unclear to me what your question is. It sounded at first like you needed a binary search, but it might just be finding a certain place in a data set and extracting stuff "behind" it. Sorting might be useful there.

It is perfectly clear to me, however, that the answer to your question is simple and straightforward in LC. Would you post a sample of the data you want to process? But then we should speak to what Klaus mentioned. Where are you in your LC learning curve?

Craig Newman

kylelawson6
Posts: 2
Joined: Tue Feb 24, 2015 10:54 am

Re: Displaying in the next line of a field

Post by kylelawson6 » Thu Feb 26, 2015 1:24 pm

Thank you Klaus, it worked perfectly!

Craig Newman, I'm using an array of numbers. It was to see how I could display the values found from the array that were greater than a specified value, without doing this:

Code: Select all

   Repeat with loop = 1 to 6
      If length_array[loop] > min_length then
         put deck_array[loop] & tab & length_array[loop] & tab & width_array[loop] & tab & cost_array[loop] into line loop+2 of field "output2"
         End if
   end Repeat
Which would result in gaps in the display if there were values that did not exceed the minimum value, between values that did, in the array. But Klaus' code worked:

Code: Select all

      If length_array[loop] > min_length then
         put cr & deck_array[loop] & tab & length_array[loop] & tab & width_array[loop] & tab & cost_array[loop] after field "output2"
         End if
I'm not really an expert with LC, just learning at school.

Post Reply