Question contains operator

anandknr

Member
Hey all,

I have a query on CONTAINS operator.

Code:
define temp-table ttTest no-undo
    field textFld as character format "x(30)"
    index idx as word-index textFld.
/*
Entered below data into ttTest, each line each record.
hello world
hello planet
hello ???
y is a word
y/n is a word
*/
for each  ttTest where ttTest.textFld contains "y" :
    disp ttTest with frame rty 8 down title "output".
end.

Now, the query will show "y is word" and "y/n is a word" but I don't want the second record to be picked. That is, I want CONTAINS to do a perfect match; not a match from the list (y/n). Is this possible?
 

Cringer

ProgressTalk.com Moderator
Staff member
Can you test for "y "? Maybe not because I know Progress sometimes ignores spaces.
If you're doing this in a serious application though, and using a real table, be aware that your query will force a whole table read as far as I'm aware.
 

tamhas

ProgressTalk.com Sponsor
Question, if it returned only the one, how would you phrase the query when you wanted both? It seems to me you are expecting the query to magically know what you want. If you want to reject some matches, then test for them after the matching records are retrieved, e.g,
if ttTest.txtField matches "*y/n*" then next.
 
Top