Quantcast

[Semediawiki-User] Querying on "Has improper value for" and error messages

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Semediawiki-User] Querying on "Has improper value for" and error messages

Andy Sweeney-2
Hello and Happy Christmas one and all!

I am currently running a geographical query whereby someone can type in
a location within the UK and the wiki automatically generates a page for
that location, centres the map on it and shows relevant results in the
area based on a geodistance query.

However, there will be occasions where someone types in a name of a
location that either doesn't exist or isn't recognised by geocoding. In
this instance, my wiki is generating a page located in the middle of
Worcestershire (for reasons that escape me!!).

What I would like to do is have an #if query so that "If the location is
unrecognised|Show a page telling people to search again|Show a page if
it is valid"

When a page with no valid location is created at the moment, the page is
generated and the following SHOULD be able to help me to solve the
dilemma, but I can't seem to do it :

1. A property in my wiki called "DistanceCheck" returns a value of
"<div><span class="errorbox">Fatal error: Parameter location must be a
valid location.</span></div><br /><br /> ", which comes in from the
google server, I assume

2. The property "Coordinates" returns "Has improper value for".

Is there a way to use an "#if" parser function on either of these? I
can't seem to manage.

I have tried :

{{#if:[[Coordinates::Has improper value for]]|Error Message|Show a page]]}}

and

{{#if:[[DistanceCheck::<div><span class="errorbox">Fatal error:
Parameter location must be a valid location.</span></div><br /><br
/>]]|Show a page|Error Message}}

and a million and one combinations there in. The whole query on the
"Show a page" contains some pipes, which I have tried replacing with
{{{1}}} and its associated template but to no avail....



Andy

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Semediawiki-User] Querying on "Has improper value for" and error messages

badon
I think there may be a simpler way to do this. The invalid locations message comes from maps or semantic maps, and has the standard error class applied to it, if I remember correctly. If so, you should be able to use the #iferror parser function to do your decision-making. Basically, it works the same as #if, but only responds to errors. If there's an error, it can provide a custom error message, a link for your users to follow. As far as I know, there's no straightforward way to automatically forward your users to another page.

I hope that helps.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Semediawiki-User] Querying on "Has improper value for" and error messages

badon
Your syntax for #iferror is correct, but I don't think you're using it correctly. Can you share your forms and pages so I can have a look at them, and see if there's a better way of doing this? I see a few mistakes that may not be worth fixing if your approach isn't quite right in the first place. Once we know the proper approach (which depends on the details of how you're doing things), then we can fuss with coding details that actually get the job done.



On Mon, Dec 26, 2011 at 6:11 PM, Andy Sweeney <andy.sweeney@childrenarewelcome.co.uk> wrote:
>
> Thanks for your reply. It didn't come through to my email account for some reason but saw it on Sourceforge :)
>
> I tried iferror as well but couldn't get it to work. It seems to be treating "Has Improper Value for" as a value, ironically! Therefore when I use {{#iferror:{{{Coordinates|}}}|Error Message|Not An Error}} it still wasn't working. Ditto for trials with #ifeq etc.
>
> Unless my syntax is badly wrong...! I'll let you know if I get anywhere as this has been a day ofmy life that I won't get back!
>
> A
>
Loading...