Page 1 of 1
Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 10:10 am
by francof
Hi all,
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
now eg. I'm looking for the code 1
Code: Select all
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?
thanks
franco
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 11:50 am
by Klaus
Hi Franco,
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!
Best
Klaus
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 1:56 pm
by francof
ciao Klaus,
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
best
franco
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 2:11 pm
by dunbarx
Hi.
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:
Code: Select all
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.
Craig Newman
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 2:40 pm
by Klaus
Buongiorno franco,
francof wrote:ciao Klaus,
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
...
Best
Klaus
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 3:26 pm
by francof
Hi Craig,
I must study your suggestion before apply it, thanks.
Klaus,
Klaus wrote:
...
AHA!
OK, why not slightly modify my initial script:
...
put 1 & SPACE into tCod
put tCod & "*" into tFind
filter tDettNomi with tFind
...
Best
Klaus
I fear of having repeated my mistake, below my data after filtering for code = 1:
Code: Select all
put tNumN & "*" into tFiltra
filter tDettDocDocg with tFiltra
the two green lines are correct, the third, the red one, is wrong (code = 10)
if I try your exemple:
Code: Select all
put tNumN & SPACE into pippo
put pippo & "*" into tFiltra
filter tDettDocDocg with tFiltra
I get an empty string.
thanks all for your time
best
franco
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 3:48 pm
by Klaus
Ciao Franco,
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!
Best
Klaus
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 4:48 pm
by francof
Hi Klaus,
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.
thank you again
best, franco
Re: Filter: to get unambiguous data
Posted: Tue Sep 09, 2014 4:51 pm
by FourthWorld
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.
Re: Filter: to get unambiguous data
Posted: Wed Sep 10, 2014 8:03 am
by francof
Hi
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.
good idea, thanks.
regards
franco