orderby lastUpdatedStamp in entity-find - moqui

I see we have a field in mysql workbench (and any other DB) named lastUpdatedStamp.
is it possible to sort the results of an entity-find using order-by tag and lastUpdatedStamp? (or maybe other solution)
like <order-by field-name="lastUpdatedStamp"/>
It's not working.

Hi Zaha I think lastTimeStamp is type of date and for date types order tag is like this :
<order-by field-name="-createdDate"/>

I was making a careless mistake as I was doing an entity-find on a view-entity with several member-entities.
I remember that it was possible to access a member-entity field by using:
<entity-alias>.<fieldName>
but it didn't work for me recently!!
So I fixed it using below line in my view-entity definition (alias lastUpdatedStamp field of THE intended member-entity )
<alias entity-alias="whatever" name="upstamp" field="lastUpdatedStamp"/>
then I was able to orderby like:
<order-by field-name="upstamp"/>

Related

Add field/string length to logstash event

I'm trying to add a string length field to an index. Ideally, I'd like to use the kibana script feature as I can 'add' this field later but I keep getting a null_pointer_exception with the following code... I'm trying to sort in a visualization based on the fields length.
doc['field'].value ? doc['field'].length() : 0
Is this correct?
I thought it was because my field isn't always set (sparse data), but I added the ?:0 to combat that (which didn't work)
Any ideas?
You can define an scripted field in Kibana, of type int, language painless, and try this:
return (doc['field'].value != null? doc['field'].value.length(): 0);

Open CMIS - Querying string property results in weird behavior

I'm executing the following SQL query:
SELECT doc.cmis:description, doc.cmis:name
FROM cmis:document doc
WHERE IN_FOLDER(doc,'folderID')
This result in something like below:
doc.cmis:description = "this is description"
doc.cmis:name = "fileName"
Now, if I add following statements, it returns zero result:
and doc.cmis:description = 'this is description'
However, if I modify and-statement with following, it works:
and doc.cmis:description like '%'
If I add one character (but not two interestingly...) as below, it also works:
and doc.cmis:description like '%t%'
It's very interesting to note that and-statement work very well with doc.cmis:name (as well as other properties).
Does anyone have clue as to why this strange / mysterious behavior is occurring?
The specifications delegate to the implementer if the cmis:description is queryable or not.
Anyway, which Alfresco version are you using ? There was an issue/bug time ago, but this should be solved: The cmis:description field should be queryable, although I don't know if it's fixed in enterprise or community.
By the way, I am currently using Alfresco Community 4.2.f and I have the same problem.

Parametrized column for Ibatis Query works first time, fails on second call

I have a problem similar (or exactly the same) to what I found here:
How to map query for iBATIS with parameterized column in select clause?
But the answer given there seems to not work for me.
I have the following:
<typeAlias alias="resultado" type="java.lang.String"/>
<typeAlias alias="parametro" type="java.util.Map"/>
<select id="getValorVariable" resultClass="resultado" parameterClass="parametro">
SELECT $campo$ FROM $tabla$
WHERE $campoClave$ = #valorClave#
</select>
The first time it executes the select, it works. $campo$ has the value 'CIF'. The second time it runs, it should have the value 'FECHA' but it keeps 'CIF'. In the function calling the select, I check the map and its values, and it has the correct ones.
Any idea? Thanks for any help.
You're facing this problem because iBatis pre-compiles the entire query except for the param values. Those are dynamically added when the query runs. So, the first time your query gets run, it gets pre-compiled with the column names in your SELECT statement.
Add
remapResults="true"
to your <select> tag.
It should read like this:
<select id="getValorVariable" resultClass="resultado" parameterClass="parametro" remapResults="true">
Further, in your <sqlMapConfig> add this to the <settings> tag:
statementCachingEnabled="false"

Rally Query using not keyword

How can you use NOT in a query? I am trying this: not ( Name contains "spike" )
It appears they now allow :
!contains, i.e.
( Name !contains "spike" )
which should work for this.
I also notice that both the contains and !contains are case-insensitive, meaning they will return the same results whether you use "spike" or "SPIKE" (at least, I believe this is the case).
Unfortunately Rally's WSAPI does not currently support a not contains operator. Please vote up this idea here:
http://ideas.rallydev.com/ct/ct_a_view_idea.bix?c=FB85CCBC-A755-42AD-AF8E-6F2B539BECEC&idea_id=61DF4D37-AFB9-487C-9046-8461D5080231

Yii framework - picking up field value from other model

I have been struggling with this, i have two models and showing data in Cgridview with one model, this model contains some id's whose values are in different table
So, i have added
'value'=> 'TblAreaoflaw::model()->FindByPk($data->typeoflaw)->areaoflaw'
which is giving this error
"Trying to get property of non-object"
Might be due to this reason that the some records doesn't exist in the TblAreaoflaw. Can't we check in this line through isset?
When i put static value, it work well, like
'value'=> 'TblAreaoflaw::model()->FindByPk(5)->areaoflaw',
Could anyone please help
thanks a lot
The error you get is because this expression TblAreaoflaw::model()->FindByPk($data->typeoflaw) is returning null. This means that you are effectively trying to get null->areaoflaw which won't work (this is what the error message "Trying to get property of non-object" clarifies).
My best guess is that $data->typeoflaw returns a non-existing primary key for the TblAreaoflaw model.
Make sure :
TblAreaoflaw is actually a model, I doubt its Areaoflaw
You have database specified primary key which is the id (5) you are passing
Try:
'value'=> '(TblAreaoflaw::model()->FindByPk($data->typeoflaw)->areaoflaw) ?
: "default or null value"'
Obviously substitute the null string to whatever you want. You may need to adjust the condition to use !empty() or similar, but see how it goes. (And if you do that or aren't using PHP 5.3, use the full ternary expression.)