Page 1 of 1
Displaying in the next line of a field
Posted: Tue Feb 24, 2015 11:05 am
by kylelawson6
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?
Re: Displaying in the next line of a field
Posted: Tue Feb 24, 2015 1:25 pm
by Klaus
Hi Kyle,
1. hello and welcome to the forum!
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
Re: Displaying in the next line of a field
Posted: Tue Feb 24, 2015 6:58 pm
by dunbarx
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
Re: Displaying in the next line of a field
Posted: Thu Feb 26, 2015 1:24 pm
by kylelawson6
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.