Access 2010 Calculate Crash on column addition - ms-access-2010

I am doing a calculate field in a table in access 2010. A column being the total is adding up to 24 other columns. I either get no return or it will crash.
I have the following in the expression builder that gives no return
[Column1]+[Column2]+[Column3]+[Column4]+[Column5]... etc
If I add an = as below, access will crash.
=[Column1]+[Column2]+[Column3]+[Column4]+[Column5]... etc
Note, both do not literally include '... etc' I just did not want to clog up the question with the column names.
I would like this to return the values of the columns being added together and totaled up. What is missing or required for this?

Related

How do I detect a specific string within five consecutive columns in a df with R, and mutate the value or copy it into another column?

I'm trying to write a script in which within my df, I want to find in several consecutive columns (e.g. 16:25) a specific string which is a combination of "SA (string and spaces within the bracket)". If the string is present in any of the columns, it will only appear in one of them.
When that string is detected, I would like it to be moved or copied to a different column named "SA_status".
If it is not found in any of the columns, then I'd like the value for that row on SA_status to appear as NA.
I've tried to create a for loop to search in the first column, and if it wasn't found, in the next one and so on; and if it was found to stop there. Then, I have used a combination of the functions mutate(), case_when(), str_detect() to copy that value into the new column.
Finally, if after doing this process the values in the new column were still blank, I've assigned them to NA.
However, I must be doing something wrong because it is not working and I'm getting really desperate.
Could you please give me a hand? Cheers!

How to Add Column (script) transform that queries another column for content

I’m looking for a simple expression that puts a ‘1’ in column E if ‘SomeContent’ is contained in column D. I’m doing this in Azure ML Workbench through their Add Column (script) function. Here’s some examples they give.
row.ColumnA + row.ColumnB is the same as row["ColumnA"] + row["ColumnB"]
1 if row.ColumnA < 4 else 2
datetime.datetime.now()
float(row.ColumnA) / float(row.ColumnB - 1)
'Bad' if pd.isnull(row.ColumnA) else 'Good'
Any ideas on a 1 line script I could use for this? Thanks
Without really knowing what you want to look for in column 'D', I still think you can find all the information you need in the examples they give.
The script is being wrapped by a function that collects the value you calculate/provide and puts it in the new column. This assignment happens for each row individually. The value could be a static value, an arbitrary calculation, or it could be dependent on the values in the other columns for the specific row.
In the "Hint" section, you can see two different ways of obtaining the values from the other rows:
The current row is referenced using 'row' and then a column qualifier, for example row.colname or row['colname'].
In your case, you obtain the value for column 'D' either by row.D or row['D']
After that, all you need to do is come up with the specific logic for ensuring if 'SomeContent' is contained in column 'D' for that specific row. In your case, the '1 line script' would look something like this:
1 if [logic ensuring 'SomeContent' is contained in row.D] else 0
If you need help with the logic, you need to provide more specific examples.
You can read more in the Azure Machine Learning Documentation:
Sample of custom column transforms (Python)
Data Preparations Python extensions
Hope this helps

Grouping, missing data - Cognos Report Studio

In IBM Cognos Report Studio
I have a data structure like so, plain dump of the customer details:
Account|Type|Value
123-123| 19 |2000
123-123| 20 |2000
123-123| 21 |3000
If I remove the Type from my report I get:
Account|Value
123-123|2000
123-123|3000
It seems to have treated the two rows with an amount '2000' as some kind of duplicated amount and removed it from my report.
My assumption was that Cognos will aggregate the data automatically?
Account|Value
123-123|8000
I am lost on what it is doing. Any pointers? If it is not grouping it, I would at least expect 3 rows still
Account|Value
123-123|2000
123-123|2000
123-123|3000
In any case I would like to end up with 1 line. The behaviour I'm getting is something I can't figure out. Thanks for any help.
Gemmo
The 'Auto-group & Summarize' feature is the default on new queries. This will find all unique combinations of attributes and roll up all measures to these unique combinations.
There are three ways to disable auto-group & summarize behavior:
Explicitly turn it off at the query level
Include a grain-level unique column, e.g. a key, in the query
Not include any measures in the query
My guess is that your problem is #3. The [Value] column in your example has to have its 'Aggregate Function' set to an aggregate function or 'Automatic' for the auto-group behavior to work. It's possible that column's 'Aggregate Function' property is set to 'None'. This is the standard setting for an attribute value and would prevent the roll up from occurring.

PHPexcel formula cell getting overrided instead of replace on filter column

I am using PHPExcel_v1_8, I have implemented formula to some cells like following.
$objPHPExcel->getActiveSheet()->SetCellValue('G4','=SUBTOTAL(2,B6:B'.$row.')');
$objPHPExcel->getActiveSheet()->SetCellValue('H4','=ROUND(SUBTOTAL(9,Q6:Q'.$row.'),2)');
I also tried like
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6,4,'=SUBTOTAL(2,B6:B'.$row.')');
Here $row means total number of rows.
But when I filter any column then it append/override value of formula applied cell. Please see following filtered total row.
I want only latest value should in filtered total row means want to replace existing value. Right now, I am getting correct value but why it is overrided? Any suggestions what can be the solution?
You've actually discovered a genuine bug here.
I wasn't aware when I implemented the SUBTOTAL logic in PHPExcel that it only worked with visible rows, and ignored hidden rows. Can you please raise an issue on the github repo
However, reading through the MS Excel docs for SUBTOTAL, a function of 2 or 9 will return the result for all rows in the range (hidden or otherwise) while 102 or 109 will return the result only for visible rows

Strange QTableWidget behavior - not all cells populated after sorting followed by repopulating

I have a QTableWidget that I populate like this:
// Clear the table
this->topPatchesTableWidget->setRowCount(0);
this->topPatchesTableWidget->setRowCount(numberToDisplay);
for(unsigned int pairId = 0; pairId < numberToDisplay; ++pairId)
{
// Display patch match scores
QTableWidgetItem* myLabel = new QTableWidgetItem;
myLabel->setData(Qt::DisplayRole, myValues[pairId]);
this->tableWidget->setItem(pairId, 0, myLabel);
... fill other columns ...
}
(I have some other UI elements to set properties that compute the values in myValues). If I change the properties, recompute, and recreate the table, everything works as expected. If I sort the table by clicking on one of the headers, it sorts correctly. HOWEVER, if at this point (after sorting) I click my button again to recompute the values and recreate the table, the table is very broken. That is, many of the cells are empty, and the cells that are not empty don't seem to be in any particular order.
By adding a manual call to
this->tableWidget->sortByColumn(0, Qt::AscendingOrder);
at the beginning of my CreateTable function, everything works as expected, but of course the newly created table is sorted by column 0 rather than the column that was selected for the last sort.
Does anyone have any idea why things would go so wrong without the call to sortByColumn? (I tried to make a simple example but I can't replicate the problem in a demo program).
Thanks,
David
I had a similar problem in python, if a column header was selected to enable sorting the cells after that column stopped populating.
I got around it by setting self.tableWidget.setSortingEnabled(False) at the beginning of the row add method, then setting it back to self.tableWidget.setSortingEnabled(True) at the end of the row add method. According to riverbank computing this is the officially recommended way to address this problem.
QTableWidget.setItem (self, int row, int column, QTableWidgetItem item)
Note that if sorting is enabled (see sortingEnabled) and column is the current sort column, the row will be moved to the sorted position determined by item.
If you want to set several items of a particular row (say, by calling setItem() in a loop), you may want to turn off sorting before doing so, and turn it back on afterwards; this will allow you to use the same row argument for all items in the same row (i.e. setItem() will not move the row).
See also item() and takeItem().
This is an elaboration on Karnisov's answer, also with PyQt. Disabling sorting before doing any setItem()s also worked for me, but it caused the user's sort selection to be lost, so I did it like this, where t is a QTableWidget:
oldSort = t.horizontalHeader().sortIndicatorSection()
oldOrder = t.horizontalHeader().sortIndicatorOrder()
t.setSortingEnabled(False)
# make the changes
t.sortItems(oldSort, oldOrder)
t.setSortingEnabled(True)
Note that it is still possible for the sort to change slightly with this code. This appears to be because the sort that Qt is using here doesn't move any items that were already in order, so if we had a table like this:
NUMBER LETTER OTHER LETTER
1 B C
2 G Q
3 A Q
If we sort by NUMBER, then by OTHER LETTER, nothing changes. But if we sort by LETTER, then by OTHER LETTER, we get:
NUMBER LETTER OTHER LETTER
1 B C
3 A Q
2 G Q
So if we had previously sorted by LETTER, then OTHER LETTER, this code would only do a single sort by OTHER LETTER, and we'd end up with the second version of the table instead of the first (assuming that the order the elements were added to the table in matches NUMBER). In this spot in my code, all items are deleted and re-added to refresh the table, so this can sometimes cause noticeable changes in order.
I had the same problem - always, when I wanted to insert new data, i buildet the header and setSortingEnabled(true). I guess the QTableWidget does not like several calls for setSortingEnabled(true). So I put it into the constructor of my MainWindown, and thats it!
I never figured out what was wrong with this. I gave up and implemented a custom model/view which is probably a much better idea anyway.

Resources