OrientDB: How to obtain an inline behavior from aggregate functions when doing UPDATE - sql-update

OrientDB has a very particular way of handling SQL aggregate functions. It treats them as aggregate when only one parameter is given, and as inline when more than one parameter are given (in contrast to relying on the given data type, and then allowing aggregates of aggregates).
So, let's say we want to draw a guest list for an event.
This won't work:
SELECT title, SET(in("Attending").name) FROM event
And instead one has to run:
SELECT title, SET(in("Attending").name, in("Attending").name) FROM event
or
SELECT title, SET(in("Attending").name) FROM event GROUP BY title
These are not great solutions, but depending on the case, one of the two always works.
This is not the case when running updates, though...
What if we need to use inline an aggregate function that doesn't take multiple lists as parameters within a query that doesn't support group by?
UPDATE event SET guest_count = sum(in("Attending").family_size)
As logical as this query may seem, it doesn't work. It returns a cumulative sum on each line. None of the following works either:
UPDATE event SET guest_count = sum(in("Attending").family_size) GROUP BY title
UPDATE event SET guest_count = sum(in("Attending").family_size, in("Attending").family_size)
UPDATE event SET guest_count = sum(in("Attending").family_size, NULL)
UPDATE event SET guest_count = sum(in("Attending").family_size, 0)
UPDATE event SET guest_count = sum(in("Attending").family_size, [0])
Any solution?

In case you need to use a function as inline when you've only one parameter, then add a second one like "null":
SELECT first( out('friends').name, null ) as firstFriend FROM Profiles
See: http://orientdb.com/docs/2.0/orientdb.wiki/SQL-Functions.html#inline-mode

Related

QuickSight: How can I use ifelse() or any other alternative for multiple conditions according to input provided in the added parameter?

I get the option of ifelse() in the Functions list when I am trying to add a calculated field while editing the data, but do not get it from the 'Add' option where I get the option to Add title, Add description, Add calculated field, Add parameter. I get options like sumif, avgif, countif but there I can provide only one condition.
I want to create an ifelse(0) function with multiple conditions dependent on a parameter value which user selects from a dropdown.
If you want to add ifelse() function you have to add it at the Dataset section. it is not available in Data analysis section.
If you want to add multiple choice values in the parameter, then you have to add the list of items by
click on Add Parameter
in the "Create new parameter" dialogue box, select multiple values then write the list of items by each line in the below text area.
then click on the create.
Currently IfEsle() is not supported in analysis based on SPICE dataset. If you want to use IfElse() in analysis convert SPICE dataset to a Direct Query dataset.

IgGrid - How to execute multiple grouping in code?

In my project I have to create my own multiple sorting and multiple grouping dialogs. Basically user can choose which columns should be included, select order and direction of operation.
For multiple sorting I use this function and it works
.igGridSorting( "sortMultiple", [exprs:array] );
The problem is now with grouiping. Is there any function which will behave similary? I mean executing with array of grouping expressions (which define columns to group by, order of grouping and direction of grouping (acs / desc)) as parameter? (this feature is supported by ignite-ui built-in dialog)
In the documentation I have found:
.igGridGroupBy( "groupByColumns" );
The description is "Adds a column to the group by columns list, executes the group by operation and updates the view."
But there is nothing about how add this columns.
There is no public API method for grouping multiple columns.
The build-in dialog sets the expressions into the datasource and also takes care to rebind the grid and rebuild the grouping area. Unfortunately none of this is exposed as public API.
So the easiest approach would be to go around the columns you need to group and invoke groupByColumn for each column.
Another thing you can do is to re-create the grid with another set of columnSettings for the GroupBy feature.

How to access another field/combo in the rowedittemplate during creation of a grid row when selectionChanged or checkValue happens?

The situation is as follows :
I am creating a row in the grid. I have several properties among which are one combo called 'department' and one field called 'name'. The business rule is that all the 'names' in a 'department' must be unique. The grid does not load all the department-name combinations so I have to make a call to the back-end. I want to make this call when
selectionChanged on the 'department' combo happens or
when 'checkValue' of the validator options of the 'name' filed happens.
This way I check when either changes. The problem is that this happens during creation and there are no rows in the datasource and no accumulated rows in the transaction log.
How can I access the fields of the 'rowEditTemplate' during creation during these particular events in order to check my values? Is there any other/better way to achieve this?
The editors are not created until you do the first edit. You could use the editRowStarted event to attach your editors logic. They are obtainable using the editorForKey method.
editRowStarted: function (evt, ui) {
var comboEditor = ui.owner.editorForKey("ProductDescription");
}
I created a small fiddle that assigns a data source for the combo on editRowStarted. It should work as a starting point for what you are trying to achieve.
http://jsfiddle.net/hfen0qea/

Infragistics UltraGrid - How to use displayed values in group by headers when using an IEditorDataFilter?

I have a situation where I'm using the IEditorDataFilter interface within a custom UltraGrid editor control to automatically map values from a bound data source when they're displayed in the grid cells. In this case it's converting guid-based key values into user-friendly values, and it works well by displaying what I need in the cell, but retaining the GUID values as the 'value' behind the scenes.
My issue is what happens when I enable the built-in group by functionality and the user groups by a column using my editor. In that case the group by headers default to using the cell's value, which is the guid in my case, so I end up with headers like this:
Column A: 7F720CE8-123A-4A5D-95A7-6DC6EFFE5009 (10 items)
What I really want is the cell's display value to be used instead so it's something like this:
Column A: Item 1 (10 items)
What I've tried so far
Infragistics provides a couple mechanisms for modifying what's shown in group by rows:
GroupByRowDescriptionMask property of the grid (http://bit.ly/1g72t1b)
Manually set the row description via the InitializeGroupByRow event (http://bit.ly/1ix1CbK)
Option 1 doesn't appear to give me what I need because the cell's display value is not exposed in the set of tokens they provide. Option 2 looks promising but it's not clear to me how to get at the cell's display value. The event argument only appears to contain the cell's backing value, which in my case is the GUID.
Is there a proper approach for using the group by functionality when you're also using an IEditorDataFilter implementation to convert values?
This may be frowned upon, but I asked my question on the Infragistic forums as well, and a complete answer is available there (along with an example solution demonstrating the problem):
http://www.infragistics.com/community/forums/p/88541/439210.aspx
In short, I was applying my custom editors at the cell level, which made them unavailable when the rows were grouped together. A better approach would be to apply the editor at the column level, which would make the editor available at the time of grouping, and would provide the expected behavior.

Returning parameters from FinalBuilder 7 Action Lists

If I'm not mistaken, it seems that FinalBuilder 7's action list parameters only support input values. Is there any way I can simulate a workaround for return parameters? I do not want to store return parameters in a global temp variable or even a stack, because I'm calling the same action list multiple times asynchronously.
Here is sample of what I want to do. (Notice the shared use of the same action list)
Async Action Group
+-Action Group
| +-Run Action List - [Do Some Calculation]
| +-Replace variable A with return parameter from previous action list
+-Action Group
+-Run Action List - [Do Some Calculation]
+-Replace variable B with return parameter from previous action list
I'm currently using an INI file in the action list to save return values. The calling method passes a parameter to the action list specifying to which INI key to save to. The calling method then reads the value from the INI from the key.
Surely there has to be a more elegant way to do this?
I have never seen any way to return variables from action lists.
That would be an excellent suggestion to post in the FinalBuilder Wish List forum.
Many of requests in the past there are now features of the product.
I think it would require giving scope to variables to something like an Action Group to pull it off. But it would help some of my scripts as well. Update: I found that FB 7 supports Local Variables. But it still does not address the needs of this answer.