Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Changed

- **Breaking change**: Changed the license from GPLv3 to a proprietary license. HyperFormula is no longer available under GPLv3; see [`LICENSE.txt`](LICENSE.txt) for the new terms. Versions 3.x and earlier remain available under GPLv3. [#1885](https://github.com/handsontable/hyperformula/pull/1885)
- **Breaking change**: Changed the `FILTER` function to return `#VALUE!` for text in its `include` argument, including the empty text and `"TRUE"`, and to return an error found there, as in Microsoft Excel. Before, it dropped those rows, or kept them for `"TRUE"`. For example, a condition column of `=IF(B1>0, TRUE(), "")` now makes `FILTER` return `#VALUE!`; return `FALSE()` instead of `""`. See the [migration guide](https://hyperformula.handsontable.com/docs/guide/migration-from-3.x-to-4.0.html). [#1891](https://github.com/handsontable/hyperformula/pull/1891)

### Fixed

Expand Down
1 change: 1 addition & 0 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
{ label: 'Migrating from 0.6 to 1.0', slug: 'guide/migration-from-0.6-to-1.0' },
{ label: 'Migrating from 1.x to 2.0', slug: 'guide/migration-from-1.x-to-2.0' },
{ label: 'Migrating from 2.x to 3.0', slug: 'guide/migration-from-2.x-to-3.0' },
{ label: 'Migrating from 3.x to 4.0', slug: 'guide/migration-from-3.x-to-4.0' },
],
},
{
Expand Down
26 changes: 26 additions & 0 deletions docs/guide/migration-from-3.x-to-4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Migrating from 3.x to 4.0"
tags:
- migration
- migrate
- upgrade
- breaking changes
- v4.0
- FILTER
---

To upgrade your HyperFormula version from 3.x.x to 4.0.0, follow this guide.

## The `FILTER` function

HyperFormula 4.0 reads the `include` argument of `FILTER`, its second argument, as Microsoft Excel does. Text in it returns `#VALUE!`, and an error in it is returned:

| Value in `include` | 3.x | 4.0 |
|:-------------------|:----|:----|
| `TRUE`, a non-zero number | The row is kept | The row is kept |
| `FALSE`, `0`, a blank cell | The row is dropped | The row is dropped |
| Text, such as `"x"` or the empty text `""` | The row is dropped | `#VALUE!` |
| The text `"TRUE"` | The row is kept | `#VALUE!` |
| An error, such as `#DIV/0!` | The row is dropped | The error |

If a condition column can hold text, for example `=IF(B1>0, TRUE(), "")`, return `FALSE()` instead of `""`. Conditions after `include`, which HyperFormula accepts in addition to Excel, still drop such rows.
Comment thread
marcin-kordas-hoc marked this conversation as resolved.
Resolved
14 changes: 12 additions & 2 deletions hyperformula/src/interpreter/plugin/ArrayPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,18 @@ export class ArrayPlugin extends FunctionPlugin implements FunctionPluginTypeche
const row = []
for (let j = 0; j < rangeVals.width(); j++) {
let ok = true
for (const filter of rangeFilters) {
const val = coerceScalarToBoolean(filter.data[i][j])
for (let k = 0; k < rangeFilters.length; k++) {
const condition = rangeFilters[k].data[i][j]
// The first condition is Excel's `include`: text in it, even "TRUE", which coerceScalarToBoolean would
// accept, returns #VALUE!, and an error in it is returned. Further conditions are HyperFormula's own
// extension and keep dropping such rows.
if (k === 0 && typeof condition === 'string') {
return new CellError(ErrorType.VALUE, ErrorMessage.WrongType)
}
const val = coerceScalarToBoolean(condition)
if (k === 0 && val instanceof CellError) {
return val
}
if (val !== true) {
Comment thread
marcin-kordas-hoc marked this conversation as resolved.
Resolved
ok = false
break
Expand Down
Loading