Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I must filter by code row content some lines of a text field containing data like this:
cod. .name
1. . .frank
2. . .bill
....
....
10. . .mark
11. . .mary
put tCod & "*" into tFind
filter tDettNomi with tFind
the code above return me frank but also mark and mary....
to get only frank, I thought to add a repeat loop, on the filtered lines only, to match the exact code.
or there is a better way?
looking at your data, it looks like this might work:
...
put 1 & "." into tCod
put tCod & "*" into tFind
filter tDettNomi with tFind
...
Get to know your data!
sorry, my fault.
the dots, to which I think you are referring, aren't in the data.
I've used they only to show data in columns.. blank spaces do not appear on the screen....
correct data are:
1 frank
2 bill
...
...
10 mark
11 mary
I think the problem with your earlier method was that the "1" was also acceptable as "10" or "11", since the first character was also a "1" in those lines.
Use an array. If you have your data in a field "toSplit", then in a button script:
on mouseUp
get fld "toSplit"
split it with return and space
end mouseUp
Place a breakpoint at the "end mousUp" line. See? The array is now in place. You can store this array in a custom property. Now whenever you want a particular line, just get the array (property) and extract for line 1, or whatever.
sorry, my fault.
the dots, to which I think you are referring, aren't in the data.
I've used they only to show data in columns.. blank spaces do not appear on the screen....
correct data are:
1 frank
2 bill
...
AHA!
OK, why not slightly modify my initial script:
...
put 1 & SPACE into tCod
put tCod & "*" into tFind
filter tDettNomi with tFind
...
francof wrote:I fear of having repeated my mistake, below my data after filtering for code = 1:
true! No comment
If my example does not work, then there is NO space after the numbers!
From your screenshot it looks like a TAB, so I will leave the appropriate modification of my actual script to you!
Sorry, but I have to say it again: GET TO KNOW YOUR DATA!
Klaus wrote:
...
If my example does not work, then there is NO space after the numbers!
From your screenshot it looks like a TAB, so I will leave the appropriate modification of my actual script to you!
...
TAB!, TAB! and TAB!
you don't belive me but, I swear, before my last reply i've tried tab instead of space. evidently I've wrong something else.
When in doubt it can sometimes be helpful to turn on the vGrid property of a field, so tabs will automatically align to the tabstops and you can spot them instantly.
Richard Gaskin LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
FourthWorld wrote:When in doubt it can sometimes be helpful to turn on the vGrid property of a field, so tabs will automatically align to the tabstops and you can spot them instantly.