Conect smartchart with smarttable in Fiori - sap-fiori

Hi i have 2 Hboxes in my view. First one is for smarttable and second one is for smart chart. Both of them are connected in one beforeRebind function where i add filter to Filters[] passed to backend.
Chart is simple summ type of value in one column from table (possible 4 values and summ of them is 100%).
What i want:
Chart and table are based on diferent OData. But when i add filter to table chart doesn't rebind and shows data for entire table (before adding filter).
Also i want to have one query to DB (now chart make one and table make one - before filtering the same entity-set but chart-one at the end adds up the occurrences of value)

Related

Google Sheets: Many to Many Table Join

I am trying to create a sheet to determine the amount of overlapping hours for employees.
I have one table with timeclock data for the Employees.
Table 1
And another with timeclock data for their Support Staff.
Table 2
This is the desired output. Each row from table A has all the date matches from table B. From here I would compute the number of overlapping hours in the final column and then roll that up into another sheet.
Table 3, Desired Output
(apologies for image links, I can't post inline images yet)
Sample sheet here Please let me know if you have any ideas for me!
I know its a combination of QUERY, ARRAYFORMULA, FILTER and more but I just can't find the right combo.
Here's a way of doing this type of join using only built-in functions:
=arrayformula(lambda(employee,support,
lambda(datecomp,
lambda(rows,
{vlookup(index(rows,,1),{row(employee),employee},sequence(1,columns(employee),2),false),
vlookup(index(rows,,2),{row(support),support},sequence(1,columns(support),2),false)})(
split(filter(datecomp,datecomp<>""),"|")))(
flatten(if(index(employee,,1)=transpose(index(support,,1)),row(employee)&"|"&transpose(row(support)),))))(
Employee!A1:D6,Support!A1:E5))
There's a lot going on here, but the basic idea is that we are comparing the date columns of each table against each other in a 2D IF array, and where the dates match we are obtaining the row index of each table. After some manipulations we can use these row indexes on each table in two side-by-side VLOOKUPs to obtain the joined table.
DMac,
I wrote myself a QUERY replacement custom function that uses real SQL select syntax.
For your data it looks something like (You need a tab called employee and a tab called support for this to work) :
=gsSQL("select * from employee full join support on employee.date = support.date")
See my test worksheet: (line 164 on gsSqlTest sheet)
https://docs.google.com/spreadsheets/d/1Zmyk7a7u0xvICrxen-c0CdpssrLTkHwYx6XL00Tb1ws/edit?usp=sharing
You need to add one Apps Script file to your sheet to give you the custom function:
https://github.com/demmings/gsSQL/blob/main/dist/gssql.js
For more help using more features see:
https://github.com/demmings/gsSQL
For example, changing the column titles, it would be like:
select employee.name as name .... (rest of your select).

Google Sheets filter() wrapped in arrayformula() without vlookup()

Reference/test sheet: https://docs.google.com/spreadsheets/d/1fp6ZTBtgb5E0J9GKOqh8Ae47OzY1smec5ha9BfUfAsY/edit?usp=sharing
I have a Google Sheets document with one sheet (calculator) that pulls some values from another sheet (database). database is organized by two columns: make, and model. I use some weird data validation and helper columns to make dropdowns in calculator. Then I use filter() to pull the matching value from database.
This all works fine but it will be a calculator that gets reused and the data discarded, so I need only a finite number of rows in calculator (10-20). For this, it would be super nice to be able to select the whole row and hit delete to clear the calculation without destroying all the formulas. Ideally, the filter() would happen inside an arrayformula() in a hidden and protected top row to allow the rows to be easily cleared.
For some reason though, I can't get that to work. vlookup() is not an option because I need to match two keys.
On another note, it would be nice to not need the helper columns B:J and the data validation unique to each row. This is workable though as I only need a few rows. In the actual version I hide and protect B:J and there are many more columns there.
I know you said Vlookup() wouldn't work because you need to match on two keys, I think that vlookup() will help in this situation. Try this formula...
=arrayformula(Vlookup(A3:A&K3:K,{database!A$2:A&database!B$2:B,database!C$2:C},2,False))
The concept here is to put those two matches you need into one unique key. So we use the curly brackets {} to build an array within the formula and combine those two lookup fields in your 'database' sheet. So the columns of A and B become concatenated into one element, and the second part of that array is the column C which you need.
To lookup then just combines your A&K columns similarly, so it can lookup that combined element. The rest of the vlookup follows as normal. I.e. we look up this concatenation against that one and when it matches it returns the second column of the array we built, in this case database!C.
I don't think I'm clear on your columns B:J, so I'm not sure if this helps you with that as well.
You can't get rid of the helper column approach, as long as you want the calculator to use drop down selection for the model. Data validation for dropdowns requires either a list of values, ie. static, so no good, or a range of cells.
What you might want to do is to put those cells in a totally separate tab, eg. DataValidation, and then hide that tab. Your Calculator sheet will then be cleaner, with no hidden columns. Column K will use for data validation the "hidden" values, formerly columns B:J, that are now built off in the DataValidation tab.

custom vaadin-grid filter for Polymer 1.0

I’m using the vaadin-grid#^3.0.2 in my polymer 1.0 project.
But I’m looking to create an on/off toggle button that will filter a column based on if the text in two columns are not a match. So if a row in column 1 contains text=“1.1.1” and that same row in column 2 contains text = “2.1.1" then I would keep this row displayed, and hide all other rows. I want to do this in javscript. I’m very new to the vaadin-grid (had so much previous experience with iron-data-table). Anyone have a suggestion on how I can access the filter function?
image of 2 different columns of versions
I tried using the standard filter element but it's too limiting because it only allows me to do string based filtering on just one-specific column, but it's not built so I can do a comparison between strings in two different columns.
<vaadin-grid-filter path="version" value="[[_filterVersion]]">
<input value="{{_filterVersion::input}}">
</vaadin-grid-filter>
One simple way to do filtering that looks at the values of two columns is to not use vaadin-grid-filter, rather just have a input field outside the grid, then filter the array bound to the grid's items property as needed.
<vaadin-textfield on-value-changed="_filterMethod"></vaadin-textfield>
_filterMethod(evt) {
this.gridItems = this.allItems.filter(it => it.col1 !== it.col2);
}
Although I may not fully understand your question as I don't why you are using an input field instead of a button. This filter method approach should work equally well if you call it from a button instead.

Fusion tables OR is not supported [duplicate]

According to https://developers.google.com/fusiontables/docs/developers_reference OR operations are not allowed as part of filter conditions. So I'm trying to come up with a creative way to solve the following:
I have a fusion table backed google map with hundreds of places and want to filter it to only places that have 'tags' or a 'title' containing a search parameter.
Ideally I could just use the following as my filter condition:
tags CONTAINS IGNORING CASE 'searchterm' OR title CONTAINS IGNORING CASE 'searchterm'
But the fusion table API simply doesn't allow it. So what to do? Make 2 separate queries, then filter out the duplicates? That means I can't use the nice FusionTablesLayer pre-rendered tile functionality.
What would you do?
A possible answer is to pre-render the data within the table. Essentially add another column which is an aggregate of tags and title. Then I only need to query the one 'tags_or_titles' column. Of course this means more data munging beforehand when I export the data into the fusion table and doesn't feel so nice and clean...
How about adding a column to your table called "Show_In_Results",
then running two separate queries to update that column for each row of data based on whether the search term is found in the specific column or not.
UPDATE 'table_id'
SET Show_In_Results = 1
UPDATE 'table_id'
SET Show_In_Results = 1
WHERE tags CONTAINS IGNORING CASE 'searchterm'
UPDATE 'table_id'
SET Show_In_Results = 1
WHERE title CONTAINS IGNORING CASE 'searchterm' and Show_In_Results <> 1
Then when you render your map layer:
SELECT 'columns' FROM 'table_id' WHERE Show_In_Results = 1

Summarized data between row labels in PowerPivot (V2) table?

What I have is:
A flat PowerPivot (V2) table to show the data as an ordinary Excel table (very much simplified, it's much wider):
|Starting date|Container|Color|Price|Price inc Tax|
|01.01.2009|container 240|blue|2,50 €|3,05 €|
|01.01.2009|container 240|red |3,60 €|4,39 €|
|01.01.2009|container 360|blue|4,20 €|5,12 €|
Might it be possible to format PowerPivot table so that the summarized columns are not in the end of a row? I'm trying to make a price list/catalog tool. There are a lot of fields in the table and some are less important and I'd like them to be shown after the prices. Starting date, Container and Color are column labels and the Price and Price Tax are summarized data.
Narutally I can't move the summarized data from Value area to Row or Column area in the field list, but is there any other way to reorder the columns so that I get the summarized data e.g. in between Starting date and Container?
Thanks!
Its possible but not totally straightforward.
Writing a measure that returns text is easy for instance:
=VALUES(Table1[Container])
....will return the text from a Column called Container in 'Table1' but ONLY if the context which has been established means that there is only one value for container (VALUES returns a single column table of all values that haven't been filtered out by the current context).
To make this robust you would need to trap errors so your whole formula would look like:
=IF(COUNTROWS(VALUES(Table1[Container]))>1,BLANK(),VALUES(Table1[Container]))
Once perfected this measure can be place after the more important data.
HTH
Jacob

Resources