Page 1 of 1
Find command
Posted: Thu May 29, 2008 11:09 am
by trevix
I'm trying to make a find command, as on OX applications, using the "find [form] textToFind [in field]" on a specific fld so that, if I look for "uno due":
- will find " other uno other due other" (on the same line)
- will not find "other uno other" (on the same line)
- will not find "other due other" (on the same line)
I tried any possible combination (string, words, chars,etc..) but I cannot find exact words with spaces or other stuff in between...
Should I build a script with recursive wordoffset and lineOffset or is there a built in way ?
Thanks
Trevix
Posted: Thu May 29, 2008 1:32 pm
by Klaus
Buongiorno Trevix,
to find the EXACT 2 words "uno due" in your field(s) you should do this:
Code: Select all
...
find WHOLE "uno due" in fld XYZ
...
Tested and works here
Best
Klaus
Posted: Thu May 29, 2008 1:40 pm
by trevix
Klaus
It is not what i was looking for...
I want to find "uno"..somethingelse.."due" on the same line.
Of course I could do:
Code: Select all
local LineaStart,CRicerca,AlmenoUno
on returnInField
if fld "CampoRicerca" is not empty then
put 1 into Lineatrovata
if LineaStart is empty or fld "CampoRicerca" <> CRicerca then
put 0 into LineaStart
put empty into AlmenoUno
put fld "CampoRicerca" into CRicerca
end if
repeat until Lineatrovata = 0
put lineoffset(word 1 of CRicerca,field "serverstatus",LineaStart) into Lineatrovata
if Lineatrovata = 0 and LineaStart > 0 and AlmenoUno is true then
put 1 into Lineatrovata
put 0 into LineaStart
next repeat
else
if Lineatrovata = 0 then exit repeat
end if
put LineaStart + Lineatrovata into Lineatrovata
repeat for each word LaParola in CRicerca
if LaParola is in line Lineatrovata of fld "serverstatus" then
put "true" into trovata
else
put false into trovata
exit repeat
end if
end repeat
put Lineatrovata into LineaStart
if trovata is true then
exit repeat
end if
end repeat
if trovata is true then
--select line Lineatrovata of field "serverstatus"
set the hilitedline of field "serverstatus" to Lineatrovata
select after last word of fld "CampoRicerca"
Put true into AlmenoUno
else
beep
end if
end if
end returnInField
This works in a Mac OSX like manner, but i tough I could use just the find command...
Posted: Thu May 29, 2008 1:46 pm
by Klaus
Hi trevix,
scusi signore, looks like I misunderstood your question complettamente!
Well in that case I am afraid you will have to use some nifty REGEX/Matchtext etc. routines, but unfortunately that is still "terra incognita" for me
Ciao
Klaus