How can I get results in the query builder snippet below that the industries page property has a value? (i.e., its value is not an empty string)
path=/content/apps
type=nt:unstructured
property=industries
property.value=
You can use the like operation for using the [jcr:like xpath function][1]
path=/content/apps
type=nt:unstructured
property=industries
property.value=%_%
property.operation=like
The corresponding xpath query would be
/jcr:root/content/apps//element(*, nt:unstructured)
[
(jcr:like(#industries, '%_%'))
]
Quoting the docs
As in SQL, the character ‘%’ represents any string of zero or more characters, and the character ‘_’ (underscore) represents any single character.
Please note that if the value contains a space alone, it is still considered valid as this function doesn't trim and then validate. Only if there is no value then it is excluded from the results.
Related
Select xmlcast('<case_id>123</case_id><checknumb>2345</checknumb>' as XML)
This query returns
<case_id;gt;123</case_id
<checknumb>2345</checknumb
How to get
<case_id>123</case_id<checknumb>2345</checknumb>
Why its coming like this when casting into xml.
Your code is trying to cast a string literal '<case_id>123</case_id><checknumb>2345</checknumb>' as an XML string, not an XML document. XML strings cannot contain angle brackets inside them, because these symbols have special meaning for XML parsers, so the angle brackets are converted to entities.
If what you really want is to convert your literal '<case_id>123</case_id><checknumb>2345</checknumb>' to an XML document, you need to make it a valid XML document first (by adding the root element) and then use XMLPARSE(DOCUMENT '<root><case_id>123</case_id><checknumb>2345</checknumb></root>') instead.
If you need to produce an XML sequence, then you should use XMLCONCAT scalar function, and not try to cast a string constant to the XML type.
VALUES XMLCONCAT(XMLELEMENT(NAME "case_id", 123), XMLELEMENT(NAME "checknumb", 2345));
If you need to produce an XML document, then you should use the following:
VALUES XMLELEMENT(NAME "doc", XMLCONCAT(XMLELEMENT(NAME "case_id", 123), XMLELEMENT(NAME "checknumb", 2345)));
I've a simple document called 'agents' under a collection named 'mycoll' with data set something like below:
{
'metadata': {
'agent-ids': ['fdfd', 'asdfasdf', 'rerere'],
'agent_ids': ['foo1', 'booo']
}
I got the document snapshot:
snapshot = firestore.client().document('mycoll/agents').get()
If I try to access 'agent-ids' field name using get() method on this snapshot:
agent-list-with-hypens = snapshot.get('metadata.agent-ids')
ValueError: Path metadata.agent-ids not consumed, residue: -ids
However, If I try to access 'agent_ids' using get() method, that works just fine:
print(snapshot.get('metadata.agent_ids'))
['foo1', 'booo']
My question is what is causing this different behavior for field-names with an '-' and why? Any documentation which explains about this? I understand that snapshot.get() accpets a FieldPath argument instead of plain string but existing API documentation does not warn that field-names with an '-' are not allowed in field-path name strings delimited by '.'
In fact, snapshot.get(firestore.client().field_path('metadata', 'agent-ids')) works just fine.
Based on the documentation, here are the constraints on field paths:
Must separate field names with a single period (.)
Must enclose each field name in backticks unless the field name meets the following requirements:
The field name contains only the characters a-z, A-Z, 0-9, and underscore (_)
The field name does not start with 0-9
So a field name/path containing dash will raise ValueError. The above constraints also explain why snapshot.get(firestore.client().field_path('metadata', 'agent-ids')) works just fine is because the field name is enclosed in backticks.
I have a list of URL's in my data. This URL information also include the URL parameters. I want to find out a list of unique url's. I mean
https://root/member_portal/javax.faces.resource/beanvalidation.js.xhtml?ln=js
https://root/member_portal/javax.faces.resource/beanvalidation.js.xhtml?ln=js&v=6.0.0 should be the same.
Is there a text operation to create a calculated field which will find the substring before the "?" sign in the URL?
Assuming that your parameterised URL data is kept in [URL] field; you may use below formula to strip the main URL part:
LEFT([URL],FIND([URL], "?")-1)
FIND returns the position of "?" character in our URL field data. And LEFT returns everything before that index - 1.
I am able to successfully retrieve the value of XML element using the following SQL
*SELECT XMLQUERY('$item/*:ItemSpec/*:AdditionalDescription/*:ABCDescription/text()' PASSING productval.value_xml as "item") AS H_DESCRIPTION FROM USER1.XMETA*
This returns a value that has double quotes (") in it. How do I replace it with a different value in the same select query. I tried something like this but it didn't work
Select REPLACE(XMLQUERY('$item/*:ItemSpec/*:AdditionalDescription/*:ABCDescription/text()' PASSING productval.value_xml as "item"),'"','QUOT') AS H_DESCRIPTION
The error is No authorized routine named "REPLACE" of type "FUNCTION" having compatible arguments was found...SQLCODE=-440,SQLSTATE==-42884.
XMLQUERY returnes an XML type, try casting it to varchar before applying REPLACE on it:
REPLACE(XMLCAST(XMLQUERY('$item/*:ItemSpec/*:Addition ...) AS VARCHAR(...)), '"','QUOT') AS ..
I am trying to send a search input to a REST service. In some cases the form input is a long string of numbers (example: 1234567890000000000123456789). I am getting 500 error, and it looks like something is trying the convert the string to a number. The data type for the source database is a string.
Is there something that can be done in building the query string that will force the input to be interpreted as a string?
The service is an implementation of ArcGIS server.
More information on this issue per request.
To test, I have been using a client form provided with the service installation (see illustration below).
I have attempted to add single and double quotes, plus wildcard characters in the form entry. The form submission does not error, but no results are found. If I shorten the number("1234"), or add some alpha numeric characters ("1234A"), the form submission does not error.
The problem surfaced after a recent upgrade to 10.1. I have looked for information that would tie this to a known problem, but not found anything yet.
In terms of forcing the input to be interpreted as a string, you enclose the input in single quotes (e.g., '1234567890000000000123456789'). Though if you are querying a field of type string then you need to enclose all search strings in single quotes, and in that case none of your queries should be working. So it's a little hard to tell from the information you've provided what exactly you are doing and what might be going wrong. Can you provide more detail and/or code? Are you formatting a where clause that you are using in a Query object via one of Esri's client side API's (such as the JavaScript API)? In that case, for fields of data type string you definitely need to enclose the search text in single quotes. For example if the field you are querying were called 'FIELD', this is how you'd format the where clause:
FIELD = '1234'
or
FIELD Like '1234%'
for a wildcard search. If you are trying to enter query criteria directly into the Query form of a published ArcGIS Server service/layer, then there too you need to enclose the search in single quotes, as in the above examples.
According to an Esri help technician, this is known bug.