Check if CQL_FILTER with WMS returns at least one feature - cql

I am using WMS CQL_FILTER option with ArcGIS JS API. The feature works fine, but I would like to know if there is a way to test whether an expression of CQL_FILTER will return at least one feature.
Is this possible? I know a CQL_FILTER will filter depending on the expression, but does it return anything?
Thank you for your help!
Julien

I don't think you can achieve that with WMS, that because the result is an image, the map.
If the provider also offers WFS, you can do a simple query to obtain the number of features with a determined filter.
Something like this could do the job,
http://your/server/wfs?request=getfeature&version=1.1&service=wfs&typename=the_namespace:the_featuretype&CQL_FILTER=the_filter&resultType=hits
Should get you something like this as a result,
<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection numberOfFeatures="X" ... />
Where, obviously, what you want is numberOfFeatures.

Related

Quire API Task.tags are always empty

i use the API to read my projects and tasks with C#. This works like a charm.
I read my tasks with the following endpoints.
https://quire.io/api/task/list/{project.oid}
and
https://quire.io/api/task/list/{task.oid}
However, the tasks have no references to the assigned tags. In the JSON-response the tags-property is always an empty array. But most of my tasks have at least one tag assigned.
Is this a known bug or did i miss something in the documentation?
Thanks for your Help.
I verified the api endpoints you describe. And in my case they result in the expected tags being listed per task. On both root tasks for a {project.oid} and subtasks for another {task.oid}.
Here a screenshot of what I get from command line (formatted the output using jq)
compared to the view inside quire:
So the answers to your questions...
No it's not a known bug on our side, and it doesn't look you missed anything based on your description. Maybe the URLs and results from my screenshots give you something to compare with.
If the problem persists on your side you can also contact support#quire.io with additional information you can't share in public.

Liferay Structure Predefined Value

Which table in Liferay stores the predefined values given for a structure.
Also is there a facility in Liferay to populate these values dynamically using webservices?
The API used to be JournalStructureService, however, as the documentation states, this has been replaced with the Dynamic Data Display API, which, for example, you can find under DDMStructureService in version 6.2.
This gives you a hint where to find the underlying data, however, you don't want to manually write to the database. You do want to use the API to change values. Trust me. Consider the database to be an implementation detail and leave it alone - if nothing else to make your next upgrade experience easier. You should never change any values in the database manually without knowing exactly what you're doing. And, trust me, the keyword here is "exactly", and you'll fail to know all the possible side effects. Don't touch it.
As said #Olaf, depends on Liferay version you will need to use the JournalStructureService or the DDMStructureService. So, if you want to use the Liferay Service by web api you have two options the Axis api where you can obtain WSDL (domain:port/api/axis) or you can use the Json api (domain:port/api/axis). In many cases you are going to need a token to use this services.

ServiceStack Razor - How to Return Validation Errors to a Form?

I'm trying to figure out if it is possible to use ServiceStack Razor for old-fashioned server-side form validation.
By way of example: a GET to a url returns a razor template with a form. When the user POSTs the form, request DTO is validated and if there were errors, the user is shown the same form, with original values re-populated as and fields in error marked somehow. If, on the other hand the request DTO is valid, the service will redirect the user to another page.
Is that scenario possible?
If so, how would one go about implementing it? I presume I'll have to write certain filters or features for this to work, however I'm wondering what strategy will require minimum amount of coding.
(I understand javascript validation is possible, however my question is specifically whether it is possible to round-trip the form with server-side validation).
Take a look at ss-validation.js, it can be used to apply validation errors to your form based on ServiceStack's ResponseStatus.
So we write all our validation code server side using FluentValidation, then on round trip ss-validation reads ResponseStatus and applies markup.
Out of the box is assumes Bootstrap style validation, but it's fairly easy to modify to suit your needs, e.g. we amended to display inline icon tool tips instead of inline/block messages, and provide an error summary.
After a lot of spelunking of the ServiceStack codebase, it seems it is theoretically possible to achieve the desired scenario.
The code already contains ModelMetadata and ModelMetadataProviders classes, and some of the HTML helpers are ported from System.Web.Mvc.
Sadly, the classes are not fully wired, so I guess it will require solid amount of work to get everything working correctly as one would expect.

All mandatory field in a xsd file?

Is there a quick way to find out all the mandatory field in a xsd file?
I need to quickly see all the mandatory fields in the schema
thanks
Not sure if you're looking to do this through code. If not, Altova XMLSpy, for example, provides an option to "Generate Sample XML File" - with options to generate only mandatory fields.
Otherwise, if you're working with Java, for example, you can use something like the Eclipse XSD project for programmatic access to the XSD. (It even works without Eclipse.) Some additional details at Are there any other frameworks that parse XSD other than XSOM? .
Take a look at this post; instead of exporting all fields, there's also an option to get only the mandatory ones... One significant difference compared with the answer you accepted is in that you can also generate an Excel or CSV file, in addition to the XML file; not to mention that the sample XML approach is deficient by definition... I would pay attention to the way mandatory choices, abstract typed elements or abstract elements with substitution groups play in your case.

Drupal Views Arguments

I know how to successfully use arguments in drupal's views module, but when it "filters" based on those arguments it uses "=" in the where clause of the SQL statement. However, I would like to use "like" instead of "=" in the where clause of the SQL statement so I can pass in, say the title of a node, as an argument and then show all nodes that CONTAIN the title passed in. I am not interested in grabbing only the nodes where the title is exactly the same as the title passed in. Does anyone know how I can do this? Is this possible?
one possible solution would be to generate the view by code with your required query.
I am looking for the same solution. It looks like you can modify the query using the views_views_pre_execute hook. The link below has a pretty good explanation. Haven't tried it yet but giving it a shot now...
http://drupal.org/node/409808
You could export the view, which outputs the views-generated query as code, then modify the query to suit your needs, and load it programatically (http://www.chilipepperdesign.com/2010/01/15/how-to-programmatically-create-views-in-drupal-6)
In drupal 7 you can use views query alter to generate your custom querys:
Take a look at this example: https://gist.github.com/4001074
I don't think you can do this. See here (https://www.drupal.org/node/1578564):
There are no options for selecting which operator should be used with contextual filters (save the exclude option). All default to is equal to.

Resources