Page 1 of 1
Find with * & string
Posted: Sat Oct 25, 2014 6:10 pm
by francof
Hi all,
I have 2 list fields:
fldTblAbbinamenti containing 2 colums of data: row1 FOODS, row2 WINES, and
fldVini containing WINES.
with this code:
Code: Select all
on mouseup
local tVinoDaAbbinare, tAbbinamenti
set itemdel to TAB
put fld "fldTblAbbinamenti" into tAbbinamenti
put "*" & the selectedText of me into tVinoDaAbbinare
filter tAbbinamenti with tVinoDaAbbinare
end mouseup
I try to show only that lines containing the selected wine in field fldVini .
do not work it returns empty.
but, for exemple, if I select the wine "Carema" from field fldVini and replace the variable of the line of code
"filter tAbbinamenti with tVinoDaAbbinare" with
"filter tAbbinamenti with "*Carema"
it's work, returns me the corrects lines
What I'm wrong?
best
franco
Re: Find with * & string
Posted: Sat Oct 25, 2014 6:39 pm
by Klaus
Hi Franco,
your FILTER will only leave lines that END with your searchstring, but not lines that have it somewhere in the middle!
Do this:
Code: Select all
local tVinoDaAbbinare, tAbbinamenti
on mouseup
## Makes no sense here :-)
## set itemdel to TAB
put fld "fldTblAbbinamenti" into tAbbinamenti
## This is the trick!
## Also add a WILDCARD * at the end of the searchstring:
put "*" & the selectedText of me & "*" into tVinoDaAbbinare
filter tAbbinamenti with tVinoDaAbbinare
...
Best
Klaus
Re: Find with * & string
Posted: Sun Oct 26, 2014 9:37 am
by francof
ciao Klaus,
thanks for your time.
Klaus wrote:
Code: Select all
..
## Makes no sense here :-)
## set itemdel to TAB
...
Best
Klaus
yes, I suppose it. was an oversight emh
the problem remains, also with the wildcard * at the end of the search string the result is empty.
Code: Select all
on mouseup
local tVinoDaAbbinare, tAbbinamenti
put fld "fldTblAbbinamenti" into tAbbinamenti
put "*" & the selectedText of me & "*" into tVinoDaAbbinare
filter tAbbinamenti with tVinoDaAbbinare -- this don't works (tVinoDaAbbinare = *Carema*)
--filter tAbbinamenti with "*Carema*" --but the same value typed like a constant string ("*Carema*") it works
end mouseup
may be something in my data?
best
franco
Re: Find with * & string
Posted: Sun Oct 26, 2014 10:01 am
by jmburnod
Ciao Franco,
I read your script and I don't find something wrong
Are you sure tVinoDaAbbinare = *Carema* ?
Best regards
Jean-Marc
Re: Find with * & string
Posted: Sun Oct 26, 2014 12:48 pm
by francof
bonjour Jean-Marc,
jmburnod wrote:Ciao Franco,
I read your script and I don't find something wrong
Are you sure tVinoDaAbbinare = *Carema* ?
Best regards
Jean-Marc
you got it. per la miseria...
there is a TAB after the name. this a screenshot of the Answer of the variable:
very apparent.but, usually, I control the variable with a Brekpoint and hovering on it with the mouse. like this

- Immagine1.jpg (5.39 KiB) Viewed 3813 times
here it's less evident.
when acquired the data, I used this function to remove duplicate lines from the variable:
Code: Select all
function deleteDuplicateLines theList --this function removes duplicate lines from a list
split theList by return and tab
combine theList by return and tab
replace tab & return with return in theList
delete the last char of theList
return theList
end deleteDuplicateLines
in this line of code: 'replace tab & return with return in theList' there was something wrong.
now it works fine. also without the second wildcard at the end of the serch string.
ciao
franco
Re: Find with * & string
Posted: Sun Oct 26, 2014 12:50 pm
by Klaus
Hi Franco,
quick guess, is the field with the "Mouseup" script LOCKED (locktext = true)?
If not, then it will NOT receive any "mouse" messages!
Best
Klaus
Re: Find with * & string
Posted: Sun Oct 26, 2014 4:33 pm
by francof
Ciao Klaus,
yes, the property locktext of the filed, in the property inspector, is checked.
the problem was in the data, again.
best
franco