Mark Terry mark at abernackie.com
Wed Mar 5 04:46:52 PST 2008


It would be easier to track if you put the text to search into a var  
(vSearchText).

local EXE
vSearchText=arraystrip(URL +" "+ Title +" "+ Notes)
ArrayFilter arraystrip (vSelectText," "), EXE," ",
	vSearchText CONTAINS "}+import()+{" AND}
EXE="Select "+EXE[1,-5]
execute EXE


On Mar 5, 2008, at 12:10 AM, Steve Kane wrote:

> I wrote a procedure triggered by the closing of a TESO that allows me
> to type several words into a TESO that will find the records which
> contain all of the words in several fields. I've got it to work but I
> think it is clumsy and I strongly suspect a real programmer would do
> it differently. I suspect there are tools in Pan 5.5 to do this more
> cleanly. To put it another way, my procedure is so Pan 1.5. I'd
> appreciate any ideas as to alternate ways of doing this that might be
> more programmer-like and maybe more portable. Alternatively, I'd like
> any ideas as to how to achieve line number 7, which would add
> parentheses which I think would make the procedure more reliable.
> Thanks.
>
> As an example, let's say the user types "  apple   mac   photo  "
> including spurious spaces into the TESO. I would like to select all
> the records which contain all of these words even if the words are in
> different fields, namely URL, Title and Notes.
>
> This is my procedure:
> vSelectText = arraystrip(vSelectText," ")
> arrayfilter vSelectText,vSelectText," ",chr(34)+import()+chr(34)
> vSelectText = replace(vSelectText," "," AND URL + Title + Notes
> CONTAINS " )
> vSelectText = "URL + Title + Notes CONTAINS " + vSelectText
> vSelectText = "Select " + vSelectText
> execute vSelectText
>
> Here's what happens:
>
> 1) user types: "  apple   mac   photo  " without the quotes
>
> 2) this procedure code cleans up the input, removing stray spaces:
> vSelectText = arraystrip(vSelectText," ")
> outputs this result:
> apple mac photo
>
> 3) this procedure code:
> arrayfilter vSelectText,vSelectText," ",chr(34)+import()+chr(34)
> outputs this result:
> "apple" "mac" "photo"
>
> 4) this procedure code:
> vSelectText = replace(vSelectText," "," AND URL + Title + Notes
> CONTAINS " )
> outputs this result:
> "apple" AND URL + Title + Notes CONTAINS "mac" AND URL + Title +
> Notes CONTAINS "photo"
>
> 5)this procedure code:
> vSelectText = "URL + Title + Notes CONTAINS " + vSelectText
> outputs this result:
> URL + Title + Notes CONTAINS "apple" AND URL + Title + Notes CONTAINS
> "mac" AND URL + Title + Notes CONTAINS "photo"
>
> 6) this procedure code:
> vSelectText = "Select " + vSelectText
> outputs this result:
> Select URL + Title + Notes CONTAINS "apple" AND URL + Title + Notes
> CONTAINS "mac" AND URL + Title + Notes CONTAINS "photo"
>
> 7) can't figure out how to achieve this output:
> (URL + Title + Notes CONTAINS apple) AND (URL + Title + Notes
> CONTAINS mac) AND (URL + Title + Notes CONTAINS photo)
>
> 8) this line executes the select:
> execute vSelectText
> _______________________________________________
> Qna mailing list
> Qna at provue.com
> http://provue.com/mailman/listinfo/qna



More information about the Qna mailing list