|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: Fri Jul 20, 2012 7:20 pm
weird mapquery problems |
ok so im getting this weird problem while using mapquery in an alias, here is a working examples
Code: |
<alias name="roomnamecpmob" id="744">
<value>$foo={The Navigation System}
#forall $foo {
$room=%mapquery( "[Name] LIKE '"%i"'")
#show $room"- "%zonename( %roomzone( $room))
}</value>
</alias>
|
it outputs 9538|9582- Storm Ships of Lem-Dagor like expected
but when i use the following
Code: |
<alias name="areawhere" id="745">
<value>$room=%mapquery("[Name] LIKE '"%1"'")
#echo $room"- "%zonename( %roomzone( $room))</value>
</alias>
|
using the same room name it outputs
- manor3
which is really not what i wanted, and i cant figure out why its doing it,
thanks in advance for the help |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jul 20, 2012 8:27 pm |
How are you executing the alias?
If you execute
Code: |
areawhere "The Navigation System" |
your alias will work.
If you execute
Code: |
areawhere The Navigation System |
your aliase won't work because %1 will only be "The".
If you want to be able to use the alias in that second form, change %1 to %params in your alias. |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Sun Jul 22, 2012 12:53 pm |
I find your %mapquery parameter a bit odd. You are using LIKE but you are not going to get rooms whose names contain your string. it should be:
Code: |
...
$room = %mapquery( ("[Name] LIKE '%" + %i + "%'") )
...
|
either "%" is optional, but you need at least one if you want a generic search. As it stands now what you have is a case-insensitive match request.
Unless, of course, you are passing ("'%" + room_string + "%'") as part of your parameter, in which case, everything is fine.
I agree with Rehab that your problem is the lack of quotes around the string (though you could change %1 to %-1 and it would work). |
|
_________________ Sic itur ad astra. |
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: Sun Jul 22, 2012 4:12 pm |
al i ment it for was case-insensitive, if i cant find a room in my mapper with the name then when i pass to the script i throw the % in where i need it
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jul 22, 2012 4:27 pm |
SQL is always case-insensitive. It won't matter if you search for "The Navigation System", "The navigation system", "the Navigation system", or any other combination of capitalization. SQL treats it all the same and will return all results from either case.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
hadar Apprentice
Joined: 30 Aug 2009 Posts: 198 Location: my apt, in california
|
Posted: Sun Jul 22, 2012 4:51 pm |
nwo if you do [Name]='string' ... it has to be exact
|
|
|
|
|
|