 |
Iceclaw Apprentice
Joined: 11 Sep 2005 Posts: 124
|
Posted: Thu Jan 05, 2006 4:02 pm
%contains() |
I need a method to determine if a 'substring' is part of a string, to be executed on a database or variable.
basically
How Would I write a query that returns all record numbers that match
a short desc containing, (and possibly equal to) a string?,
%query(&Short_Desc= <What Goes here?> |
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu Jan 05, 2006 4:17 pm |
try %remove or perhaps %pos and %copy
|
|
_________________ Taz :) |
|
|
 |
Iceclaw Apprentice
Joined: 11 Sep 2005 Posts: 124
|
Posted: Thu Jan 05, 2006 4:26 pm |
I guess I dont understand is what I use to refrence it.
%query(%pos("Test",&Short_Desc)>0)
?? |
|
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu Jan 05, 2006 5:25 pm |
#function instr {%if(%pos(%2,%1),%copy(%1,%pos(%2,%1),%len(%2)),0)}
#show @instr(albert,cheese) = 0
#show @instr(albert,ber) = ber
given this you should now be able to do the following:
%query(@instr(&Short_Desc,Test))
hope this helps |
|
_________________ Taz :) |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Jan 06, 2006 1:45 am |
%query(%pos("Test",&Short_Desc)>0) or %query(%pos("Test",&Short_Desc)) should work fine.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Jan 06, 2006 2:03 pm |
%pos returns a number doesn't it? Is a number useful for %query doesn't it need to be passed a string? Confused now 
|
|
_________________ Taz :) |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Jan 06, 2006 11:47 pm |
%query takes a parameter of type 'expression' so it doesn't preform expansion or evaluation immediately, instead it preforms them for each record. All those that evaluate to true are returned, so any non-zero, non-null result will count as true, adding that record to the return list.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Mon Jan 09, 2006 3:19 pm |
Yep looked at what you said and the help again and now I get it. Thanks
Sorry for confusing the issue Iceclaw, though you may still find that function useful for other things. |
|
_________________ Taz :) |
|
|
 |
|
|
|