Create a summary table from data frame which contain cells as list - pivot-table

I have the following data frame, each cell in the data frame is a list in different size.
Current data frame1
I want to create a new data frame which look like that from the above one:
New data frame
Is it possible with the current layout?

Related

How to refer to an ever expanding column of data automatically?

I have a column of data which contains a list of unique IDs.
There are a set of tabs which then uses this list to display various associated data against each ID.
Presently, any time a new ID is added, I must manually add the new ID to each subsidiary tab in order to get the data.
I'd like to do this automatically, such that an addition to the master list populates into the tabs. I don't know of a way with my (limited) knowledge of google sheets to do this, however- any ideas? :)
The basic way to do this is to initialize the first column in each tab with a simple '='Master List'!A1' and copy it down. This works, but if you sort the master list, it plays havoc with tabs.
Difficult to explain, but something like:
Master List tab
12
13
35
111
Data Tab #1
12 Orange
13 Pear
35 Apple
111 Dragonfruit
Data Tab #2
12 Orange
13 Green
35 Red
111 White
Data Tab #3
12 Tart
13 Juicy
35 Crisp
111 Dried
...now, if I add 140 to the Master List, I must (currently) manually populate Data Tab #1-3. I'd like it to populate automatically.
I update the Master List, and all associated Tabs show the new entry.
In each Data Tab, instead of
'='Master List'!A1' and copy it down
try
=arrayformula('Master List'!A1:A)
This is an array formula and does not need to be copied down. It will populate the entire column with the IDs.
This works nicely too:
={'Master List'!A:A}
try like this:
=INDIRECT("'Master List'!A1:A"&COUNTA('Master List'!A1:A))

ExtJS and simple grid panel

I have a simple grid without direct connection with any database table. Just days of mounth in raws and persons in columns (let's say 31 x 20). In init procedures I read data from some tables, calculate and write them to this grid. Then I have to calculate lot of indexes, make some summs by raws, columns and part of them. Just statistics.
There's no problem with read from grid cells, this is very quick. I have a problem with writing data to the cells. E.g. procedure to fill this grid is the following:
days = Ext.getStore('StoreDays').getRange();
employees = Ext.getStore('StoreTeam').getRange();
Ext.each(days, function (day) {
Ext.each(persons, function (guy) {
tmp = day.get('from');
day.set('start_' + persons.data.prs_numer, start);
... and 4 additional SET operations to grid cells
});
});
And this procedure work more then 3 minutes!!! I don't know why and how to write good code to write this data normally. Be so kind and prompt me HOW!
Additionally I can't refresh e.g. every single raw after raw settings as I want.
Would you be so kind as to prompt me?
A cell update could mean the grid needs to refresh itself, so it does that 31x20x5 (31 rows, 20 columns, 5 times per cell) times!
Instead, do this:
store.suspendEvents();
// Do your update
store.resumeEvents();
grid.getView().refresh();

Optimization issue. How to check if a dataset is empty?

I'm designing a report where certain Detail bands should be printed only if they contain some data. This data is fetched by a separate query (dataset) for each band. I want to use the Print When Expression property to toggle Detail band visibility.
Is there a normal way to find out whether the dataset is empty for the report or do I have to write a crazy main query which will count rows for all datasets? That means actually duplicating queries from datasets which I'd like to avoid.
UPD:
The report is structured as follows:
A main query is called to prepare the base part of the report. This is the part which is always there.
Then there are a number of different queries (datasets) to the same datasource which may or may not return some data.
Data from each additional dataset is displayed in a table in a separate Detail band. Each detail band also contains some static content, such as labels and so on.
If the additional dataset returns no data, the entire Detail band should not be printed
------------------------------------------------------------------------
* Detail band 1.
*
* Contents of the main query here.
*-----------------------------------------------------------------------
* Detail band 2.
* Band label
* Contents of the additional dataset A in a table
*
* other static stuff
*-----------------------------------------------------------------------
* Detail band 3.
* Band label
* Contents of the additional dataset B in a table
*
* other static stuff
*-----------------------------------------------------------------------
* and so on
Here entire band 2 with all its contents should not be displayed in case there is nothing in additional dataset A

Taking too long to retrieve and display the result in the telerik grid.

I have a MVC application in which I need to display the data from 3 tables. I am using entity model for it. Out of these, in 2 I have made the association:users and payment table.
And 3rd table month_<monthid> is created every month to store the users to whom the magazine is sent. The table name month_<monthid> is generated dynamically by selecting the month so in order to fetch the data I have used ExeuteStoreQuery. For small amount of data the listing is fast but for large amount it is very slow.
Now I have created a class to bind to grid which will include all the fields from the 3 tables to display.
But here when I am getting the large volume of data about 12000 then it is taking about 30 min to go through the loop and assigning the data to the class object and then adding to the list of the result which is finally binded to telerik grid.
I am hereby attaching the sample code using a link. Is there any direct way to bind the query result of joined tables to grid instead of going through the loop and preparing the list for the model class I think that will save time.
The code block of preparing the list using the Executestorequery is under the function GetuserList().
foreach (var r in result)
{
Result objresult = new Result();
var paymentresult = from sub in dtpayment.AsEnumerable() where sub.Field<int>("user_id") == r.user_id select sub;
if (paymentresult.Count() > 0)
{
objresult.amount_paid = paymentresult.FirstOrDefault().Field<decimal>("amount_paid");
objresult.magzine_id = paymentresult.FirstOrDefault().Field<int>("magzine_id");
}
objresult.address=r.address;
objresult.email=r.email;
objresult.name=r.name;
objresult.user_id=r.user_id;
objresult.month= smonth;
lstresult.Add(objresult);
}
This code block of for loop is taking very time where I am using ExceuteStoreQuery.
But I have observed that simply by joining the users and payment table using LINQ query to get all the 12000 records i.e no involvement of month table the result is appearing faster.
So,can you suggest any way to improve the performance of my application?
Also include the database structure with the sample code.
Below is the link to sample
http://sampletestone.s3.amazonaws.com/magzine.7z?AWSAccessKeyId=AKIAINHDRCMKC5GUSNFA&Expires=1303583399&Signature=8o8Wn6UNjbEl3dIyipAX9xH29Hg%3D
supriya
Nobody in the world wants to see 12,000 records. You should look at implementing paging & searching functionality.

how to string a data from uitable that been input by the user?

I'm trying to build a matrix form by creating a uitable in GUIDE. So I want the user to enter data into the table and I want to use the data at the pushbutton. But I dunno how to string the data from the table to the pushbutton. Is there any way to program the table? Im just take callback only. Do I have to take the create function, cellselectionfunc and etc in my m-editor?
I want to make a 3 by 3 matrix, but I cannot edit the row at property inspection. When I delete the 4th row and I apply, its always has 4 rows. I just want to make 3 by 3 matrix. Not 4 by 3.
Assuming the tag property on your uitable is MyTable the following code will get the data from the table.
data = get(handles.MyTable,'Data');
If you put this code into your button callback (assuming your button has a tag of MyButton this will be function MyButton_Callback(hObject, eventdata, handles)) you should be able to see the table data when the button is clicked.
You can initialise the table data in the figures 'OpeningFcn' (which should have been created by Guide) to a 3x3 cell matrix.
handles.output = hObject;
% Initialise MyTable data to a 3x3 matrix
set(handles.MyTable,'Data', cell(3,3));
% Update handles structure
guidata(hObject, handles);

Resources