Gremlin: toLowerCase() not working properly - orientdb

I have a vertex called 'city' that has property [cityName] "Miami" and property [syonyms] "Miami^Magic City^Little Cuba".
The following query returns no results:
g.V().hasLabel('city').has('syonyms',filter{it.get().toLowerCase().contains('Miami')})
While this query gives me the results that I want:
g.V().hasLabel('city').has('syonyms',filter{it.get().toLowerCase().contains('miami')})
I thought that the "toLowerCase()" would convert "Miami" into all lower case, but it doesn't seem to be doing that. Any ideas?

Adding toLowerCase() at the end of the value within "contains" solved the issue.
g.V().hasLabel('city').has('syonyms',filter{it.get().toLowerCase().contains('Miami'.toLowerCase())})

Related

AEM CQ5 Query Builder: How to get result by searching for 2 different values in same property?

I want to get result matches with all nodes contains property 'abc' value as 'xyz' or 'pqr'.
I am trying in below ways:
http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&property=abc&property.1_value=/%xyz/%&property.2_value=/%pqr/%property.operation=like&p.limit=-1&orderby:path
http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&property=abc&property.1_value=/%xyz/%&property.2_value=/%pqr/%&property.1_operation=like&property.2_operation=like&p.limit=-1&orderby:path
http://localhost:4502/bin/querybuilder.json?path=/content/campaigns/asd&1_property=abc&1_property.1_value=/%xyz/%&1_property.1_operation=like&2_property=abc&1_property.1_value=/%xyz/%&2_property.1_operation=like&p.limit=-1&orderby:path
But none of them served my purpose. Any thing that I am missing in this?
The query looks right and as such should work. However if it is just xyz or pqr you would like to match in the query, you may not need the / in the values.
For eg.
path=/content/campaigns/asd
path.self=true //In order to include the current path as well for searching
property=abc
property.1_value=%xyz%
property.2_value=%abc%
property.operation=like
p.limit=-1
Possible things which you can check
Check if the path that you are trying to search contains the desired nodes/properties.
Check if the property name that you are using is right.
If you want to match exact values, you can avoid using the like operator and remove the wild cards from the values.
You can actually use the 'OR' operator in your query to combine two or more values of a property.
For example in the query debug interface : http:///libs/cq/search/content/querydebug.html
path=/content/campaigns/asd
property=PROPERTY1
property.1_value=VALUE1
property.2_value=VALUE2
property.operation=OR
p.limit=-1
It worked with below query:
http://localhost:4502/bin/querybuilder.json?orderby=path
&p.limit=-1
&path=/content/campaigns
&property=jcr:content/par/nodeName/xyz
&property.1_value=pqr
&property.2_value=%abc%
&property.operation=like
&type=cq:Page
Note: property name should be fully specified form the type of node we are expecting.
Ex: jcr:content/par/nodeName/xyz above instead of just xyz

SAPUI5 TableSelectDialog Search Value

I'm using TableSelectDialog control where I'm also performing some search. In order to get the search value on livesearch, i'm using oControlEvent.getParameters.value but it returns me undefined as I see it in an alert box.
Any idea why it is giving me undefined or any other way I can get the value I typed in search field.
This works with oEvent.getParameters().value.
Another idea, as most used way to find the query value is for a SeachField, we use
oEvent.getSource().getValue
Here, you can also find the query string similarly:
oEvent.getSource()._oSearchField.getValue()
Adding to the other answers here you can also do:
onSearch: function(oControlEvent) {
oControlEvent.getParameters("value");
}
https://sapui5.hana.ondemand.com/#/api/sap.m.TableSelectDialog/events/search

FindBy property in TYPO3 Extbase MVC is not working

I'm unable to run the FindBy magic function property in Extbase MVC
$title=array(0 =>'Books Day');
$each_event=$this->eventRepository->findByTitle($title);
$each_event is returning an object of type TYPO3\CMS\Extbase\Persistence\Generic\QueryResult .
How do I make this work?
I also tried passing in a string to findByTitle and findByOne. Both don;t work! :(
I'm using TYPO3 6.1 and extension builder.
The last part of those magic functions always needs to be a field in the database. So "title" must be in your model. You might have a field "one" for your object, but I guess you meant findOneByTitle?
The object type QueryResult is correct. You can turn it into an array for debugging purpose for example:
$foo = $query->execute()->toArray();
By the way: check wether your eventRepository is null or not and you could try this to see if it works at all:
$result = $this->myRepository->findAll();
Try
$each_event=$this->eventRepository->findByTitle($title)->toArray();
Reference to the QueryResult.
As said in the documentation, it returns a QueryResultInterface|array.
As a consequence you have to loop over the result like this:
foreach($each_event as $single_event) {
$single_event->getProperty();
}
If you are sure that it returns only one single value you could also access it by the index 0:
$each_event[0]->getProperty();

how to use divide() method in jasper reports?

Im using iReport1.3.3 tool to create pdf and xls template ..
My problem is for the below expression,
($V{strloanNo}).divide($V{loanCalculation})
i need to divide both the variables but i am not getting expected result. it is displaying "null" value .
any idea guys?
$V{x}.divide( $V{y} )
This works for me.
It looks like your variables are Null.
Make sure to set the Initial Value Expression in the variable's properties.
I set both of mine to below.
new java.math.BigDecimal(10.0)
Guess you can try this out -
$V{strloanNo}.floatValue()/$V{loanCalculation}.floatValue()
As it was discussed
here, you can check this:
$F{Attribute_a}.divide($F{Attribute_b}, new MathContext(100))
If your division results in a non-terminating decimal then an exception is thrown. So you scale simply it to something reasonable and exception be gone.
$F{Attribute_a}.divide($F{Attribute_b})
and class type should be java.math.BigDecimal
if attribute b is zero, please put the condition

How to use "not" in XPath?

I want to write something of the sort:
//a[not contains(#id, 'xx')]
(meaning all the links that there 'id' attribute doesn't contain the string 'xx')
I can't find the right syntax.
not() is a function in XPath (as opposed to an operator), so
//a[not(contains(#id, 'xx'))]
you can use not(expression) function
or
expression != true()
None of these answers worked for me for python. I solved by this
a[not(#id='XX')]
Also you can use or condition in your xpath by | operator. Such as
a[not(#id='XX')]|a[not(#class='YY')]
Sometimes we want element which has no class. So you can do like
a[not(#class)]
Use boolean function like below:
//a[(contains(#id, 'xx'))=false]