Sum search results or values in set date range? #9174
-
I have persuaded wife to manage her transactions using Firefly III. Done the import from bank from start of year until now and made all the automation rules. She was still not 100 % sure if she would use this until I showned her how much she spents in shops :). Now she wants to check per date range and with search results how much she spent, but search results do not get summed. The same goes with results from Classification->Categories We went to shops on Friday. She added all the transaction with (Shop Name) and they get put in same Shop category. How would she get sum of Category named Shop only for that one day (or a week, or whatever date range she has set)? All I see is sum per whole month. And same for search result. For example if she searches for specific shop name she gets all transactions in results but she is missing sum of all values: Thank you for the tips. Hopefully this is already implemented inside, I just do not know how to find this. It would increase the WAF. :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hey, good question. Check out the reports page :). You probably want the category report. |
Beta Was this translation helpful? Give feedback.
-
With the obvious disclaimer to NEVER run code in your browser you got from somewhere random in the internet, especially if you don't fully, 100% understand and trust it and its author: Here is a javascript function that can be used to sum up the values in a search. It can only work on the ones visible, thus for searches that return so many results that it paginates, it won't work. // get the div of the search result, (as of now) its second child is the results table, get the rows of that
let rows = [...document.getElementsByClassName('search_results')[0].children[1].rows];
let sum = 0.0;
rows.forEach(function(row, row_idx, rows) {
let cells = [...row.cells];
// result rows (currently) always have 9 entries, and we don't care about the table header
if (cells.length != 9 || cells[2].nodeName === 'TH') {
return;
}
// transform the text to a number
let saldoString = String(cells[2].innerText);
let saldoValue = Number(saldoString.split(/(\s+)/)[0].trim().replace('.','').replace(',', '.'));
// sum it up
sum += saldoValue;
});
// print it out
alert(`Sum in search: ${sum}€`); You can also create a bookmark with the function wrapped like in the following snippet as the URL of the bookmark to have it easily accesible in your browser: javascript:(function() { let rows = [...document.getElementsByClassName('search_results')[0].children[1].rows]; let sum = 0.0; rows.forEach(function(row, row_idx, rows) { let cells = [...row.cells]; if (cells.length != 9 || cells[2].nodeName === 'TH') { return; } let saldoString = String(cells[2].innerText); let saldoValue = Number(saldoString.split(/(\s+)/)[0].trim().replace('.','').replace(',', '.')); sum += saldoValue; }); alert(`Sum in search: ${sum}€`); }()); Again, running code in your browser from some stranger on the internet is almost never a good idea. It also doesn't work with pagination in search and it could break at any moment as it is not using any official API but just scrapes the info from the current state of the HTML, which could potentially (and rightfully so) change with any update. It's also in no way polished. It will also only work for the search, not the categories page (although something similar could be build for that page, too). |
Beta Was this translation helpful? Give feedback.
Hey, good question.
Check out the reports page :). You probably want the category report.