Code: Select all
$chosenColumns = inputselect("Select column(s) to sum up", $columnHeaders, ",", 2+8192+16384, , 300, 400);
Code: Select all
$chosenColumns = inputselect("Select column(s) to sum up", $columnHeaders, ",", 2+8192+16384, , 300, 400);
text...
line with:text $log, 900, 600;
highend wrote: ↑21 Sep 2023 19:55 This should work for all column setups...
Code: Select all
$columnHeaders = setcolumns(, 64); // ","-separated // E.g.: Name,Price $,Sold $,Modified,Created $visibleColumns = regexmatches(columnlayout(, "get"), "\+[^.]+"); // E.g.: +Name|+Extra 1|+Extra 2|+Modified|+Created // Make sure both counts are equal, otherwise a "," is used as a caption in a column $cntColumnHeaders = gettoken($columnHeaders, "count", ","); $cntVisibleColumns = gettoken($visibleColumns, "count", "|"); end ($cntColumnHeaders != $cntVisibleColumns), "A ',' is not allowed in column header(s), aborted!"; $chosenColumns = inputselect("Select column(s) to sum up", $columnHeaders, ",", 2+8192+16384, , 300, 400); end !($chosenColumns), "No column(s) chosen, aborted!"; // Create report $selected = <get SelectedItemsNames>; $itemList = ($selected) ? 1 : 0; $report = report("|", $itemList); // E.g.: 1|deep cool fans|$30,00||21.09.2023 14:15:03|21.09.2023 14:15:03 // 2|dewalt - drill 12v|$25,00|$20,00|21.09.2023 14:15:09|21.09.2023 14:15:09 // 3|dewalt - drill 20v|$100,00|$90,00|21.09.2023 14:15:21|21.09.2023 14:15:21 // 4|tripod||$10,50|21.09.2023 14:15:36|21.09.2023 14:15:36 // Remove line numbers if visible $report = get("#406") ? regexreplace($report, "^\d+\|") : $report; // Get the digits of the columns to autosum $chosenDigitColumns = ""; foreach($column, $chosenColumns, ",", "e") { $chosenDigitColumns .= gettokenindex($column, $columnHeaders, ",", "") . "|"; } $chosenDigitColumns = trim($chosenDigitColumns, "|"); // Sum up $log = ""; foreach($num, $chosenDigitColumns, "|", "e") { // Create and initialize count variables $var = '$col_' . $num; *$var = 0; // Get the real column name $realColumn = gettoken($columnHeaders, $num, ",", "t"); status "Calculating " . quote($realColumn) . " ...", , "progress"; foreach($line, $report, <crlf>, "e") { $value = gettoken($line, $num, "|", "t"); $value = regexmatches($value, "[0-9,.]+"); *$var += $value; } // Create log $log .= "Sum [" . $realColumn . "]: " . *$var . <crlf>; } end !($log), "No log created?"; text $log;
report()
is still broken (for custom, not for extra columns), I guess Don will fix it soon...Code: Select all
1|2012-03-01(2011-528, Accum.Depreciation)[4295.94]{170.33} $4466.27.pdf|4295.94|4295.94|4466.27|23.04.2025 16:09:56|23.04.2025 16:09:56
2|2013-03-01(2012-528, Accum.Depreciation)[0.00]{0.00} $0.00.pdf|0.00|0.00|0.00|23.04.2025 16:09:56|23.04.2025 16:10:58
3|2014-03-01(2013-528, Accum.Depreciation)[5131.31]{622.99} $5754.30.pdf|5131.31|5131.31|5754.30|23.04.2025 16:09:56|23.04.2025 16:11:53
Code: Select all
1|2012-03-01(2011-528, Accum.Depreciation)[4295.94]{170.33} $4466.27.pdf|{:d-17}|{:d-18}|{:d-19}|23.04.2025 16:09:56|23.04.2025 16:09:56
2|2013-03-01(2012-528, Accum.Depreciation)[0.00]{0.00} $0.00.pdf|{:d-17}|{:d-18}|{:d-19}|23.04.2025 16:09:56|23.04.2025 16:10:58
3|2014-03-01(2013-528, Accum.Depreciation)[5131.31]{622.99} $5754.30.pdf|{:d-17}|{:d-18}|{:d-19}|23.04.2025 16:09:56|23.04.2025 16:11:53
{:d-17}
come from.