How to add left-side dropdown to choose the operator - slickgrid

I try to add left-side dropdown in filter.DateRange, but i don't know how to do it
I would like to user have possibilty to choose range or single date with '<' , '>' etc in one column.

I'm the author of Angular-Slickgrid
The left-side dropdown you're talking about is only available for Compound Filters and the Date Range is not a Compound Filter. There is no need and no use case for this Filter to be a Compound Filter, I will not add such feature. You can however set the Operator to be inclusive (>= date1 && <= date2) or exclusive (> date1 && < date2) in your column definition. The Range Filters versus Compound Filters are very different, you cannot add all operators of a Compound Filter into a Range Filter (<, <=, <>, >, >=) that just doesn't make any sense, what make sense on a range is to know if it's inclusive/exclusive and that is available just not dynamically.
this.columnDefinitions = [
{
id: 'finish', name: 'Finish', field: 'finish',
formatter: Formatters.dateIso,
type: FieldType.date,
filter: {
model: Filters.dateRange,
operator: OperatorType.rangeInclusive, // defaults to exclusive
}
},
// ...
];
If you really wish to somehow build a Compound Date Range Filter, your only option left would be to create your own Custom Filter, for that follow the instruction on the Wiki - Custom Filter, you could possible Extend the built-in Date Filter.

Related

How to Select multiple related columns in add calculated fields in Quicksight parameter using ifelse?

I have a parameter 'type' in a table and it can have multiple values as follows -
human
chimpanzee
orangutan
I have 3 columns related to each type in the table -
human_avg_height, human_avg_weight, human_avg_lifespan
chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan
So if i select the type as human, the quicksight dashboard should only display the three columns -
human_avg_height, human_avg_weight, human_avg_lifespan
and should not display the following columns -
chimpanzee_avg_height, chimpanzee_avg_weight, chimpanzee_avg_lifespan
orangutan_avg_height, orangutan_avg_weight, orangutan_avg_lifespan
I created the parameter type and in the add calculated fields I am trying to use ifelse to select the columns based on the parameter selected as follows -
ifelse(${type}='human',{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function})
I also tried -
ifelse(${type}='human',{{human_avg_height}, {human_avg_weight}, {human_avg_lifespan},{function}})
And -
ifelse(${type}='human',{human_avg_height, human_avg_weight, human_avg_lifespan},{function}})
But none of it is working. What am i doing wrong ?
One way to do this would be to use three different calculated fields, one for all the heights, one for weights and one for lifespan. The heights one would look like this:
ifelse(
${type}='human',{human_avg_height}, ifelse(
${type}='chimpanzee', { chimpanzee_avg_height}, ifelse(
${type}='orangutan',{ orangutan_avg_height},
NULL
)))
Make another calculated field for weights and lifespan and then add these calculated fields to your table, and filter by type.
To make it clear to the viewer what data is present, edit the Title of the visual to include the type:
${type} Data
You have to create one calculated field for each measure using the ifelse with the type to choose the correct vale, but is not necessary to create inner ifelse as skabo did, the if else syntax is ifelse(if, then [, if, then ...], else) so you can define the calculated fields as follows:
avg_height = ifelse(${type}='human', {human_avg_height}, ${type}='chimpanzee', {chimpanzee_avg_height},${type}='orangutan', {orangutan_avg_height}, NULL)
avg_weight = ifelse(${type}='human', {human_avg_weight}, ${type}='chimpanzee', {chimpanzee_avg_weight},${type}='orangutan', {orangutan_avg_weight}, NULL)
avg_lifespan = ifelse(${type}='human', {human_avg_lifespan}, ${type}='chimpanzee', {chimpanzee_avg_lifespan},${type}='orangutan', {orangutan_avg_lifespan}, NULL)
Then use those calculated fields in your visuals.

Is it possible to add custome condition in filters?

I want to add greater then and lessthen condition in below example. is it possible?
Be careful about the option columns of your Handsontable definition.
The option Filters already have conditions 'Greater than' & 'Lesser than' but they will be available only for 'numeric' data type.
If I take this example, regardless of the data type, the conditions won't be available.
Now if I add the columns option in this edited example :
columns: [
{type: 'text'},
{type: 'numeric'},
],
The conditions you need will became available for the 2nd column.
Check Filter By Condition in dropdown
Fiddle Link :
http://jsfiddle.net/kumarrishikesh12/wr7snuws/

Sonata admin, use text filter for date filter

I'm using SonataAdminBundle and I have a question about filters.
When I have a text field in my entity, in my filter I can see 3 types of filters :
contains
not contains
is equal
When I have a date field in my entity, i can see these filters :
=
>=
<
...
How can I use text filters instead of date filters (or math filters) when I have a date field ?

Crystal Report group sort order

I'm making a report that will display a list of costumers and some numeric values.
I use a formula in order to sort my group, wich is the following :
if {Db.SortOrder} = 0 then
{Db.CostumerName}
else
ToText({Db.Value},'00000000',0,'')
In this way i can group by costumer name or value, the problem is that i need to use a different sorting order for them, ascending order when i group by CostumerName and descending when i group by Value. How can i achieve that ? I've tried the "Sort group by formula" using crAscendingOrder,crDescendingOrder but it said i needed tu use a costant and not a variable (in my case i used db.SortOrder)
My approach:
First, create a parameter field ({?Sorted Field}) to choose the sorted field: String; static list that includes 'Customer' and 'Value'; default value is 'Customer'
Next, create a custom function that will convert a string into its ASCII representation, allowing the order to be changed:
// ASCII()
Function (Stringvar characters, Optional Numbervar direction:=crAscendingOrder)
Local numbervar i;
Local stringvar c;
For i:= 1 To Len(characters) Do (
If direction=crAscendingOrder Then
c:=c + ToText( Ascw(Mid(characters,i,1)), "#")
Else
c:=c + ToText( 256- Ascw(Mid(characters,i,1)), "#")
);
c;
Next, create a formula field that will be used for sorting:
// {#Sorted Field}
Select {?Sorted Field}
Case "Customer": {Db.Customer}
Case "Value": ASCII(ToText({Db.Value},'00000000',0,''), crDescendingOrder)
Default: {Db.Customer}
Finally, reference this field in the record-sort expert:
in my case i only needed to choose the field to sort by. i created the parameter field called SortField as static text and created the three friendly values i wanted to show, then created the formula that referenced it. i have crystal 2011 so my formula looks like this:
// {#Sorted Field}
Select {?SortField}
Case "BIN":{V_ITEM_MASTER.BIN}
Case "ORDER REF":{V_ITEM_MASTER.HEAT}
Case "PART":{V_ITEM_MASTER.PART}
Default: {V_ITEM_MASTER.BIN}

queryContext - filtering with numbers neo4j/lucene

I'm trying to filter a wildcard query in neo/lucene using numeric range.
I want to search for all nodes (documents) having key "actor" starting with "rob" and age > 20:
WildcardQuery luceneQuery = new WildcardQuery( new Term("actor", "rob*" ));
QueryContext qx = new QueryContext(luceneQuery)
.numericRange("age", 20, null)
.sortNumeric("age", true);
IndexHits<Node> hits = lucene.query(qx);
Once I add numeric range the wildCard query does not works, it only orders by numeric range.
Is it possible to combine both wildcard and numeric?
Thanks,
Daniele
I suspect you want to use a BooleanQuery to combine the WildcardQuery with the numeric range query. (I normally use QueryParser, myself, rather than building the queries by hand.)
For your example query, the QueryParser syntax would look like:
+actor:rob* +age:{20 TO 123}
where +age:{20 TO 123} asks for age > 20 AND age < 123 (the oldest well-documented person lived to 122). The "+" operators force both of those terms to occur in the document.

Resources