Bug 107885 - VBA AutoFilter can't compare strings
Summary: VBA AutoFilter can't compare strings
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.1.0 target:7.0.0.2
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2017-05-16 07:44 UTC by Szymon Kłos
Modified: 2020-07-15 17:52 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Document with test macro (7.73 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-05-16 07:44 UTC, Szymon Kłos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Kłos 2017-05-16 07:44:14 UTC
Created attachment 133352 [details]
Document with test macro

1. Open attached document
2. Run macro: VBAProject -> Modules -> Module1 -> AF

Result:
All data rows are hidden

Expected:
Only row containing "A" (row 2) should be hidden

Used method in the macro:
AutoFilter Field:=1, Criteria1:=">A", Operator:=xlFilterValues

AutoFilter can only check if Criteria1 string is "equal to". Comparing with ">" "<" or "=" should be supported.

Code pointer:
http://opengrok.libreoffice.org/xref/core/sc/source/ui/vba/vbarange.cxx#4493
Comment 1 Jacques Guilleron 2017-05-16 23:30:40 UTC
Hi Szymon,

Criterial:"<>A" can be used.
Help pages at Operators Standard Filters give other useful combinations.
https://help.libreoffice.org/Common/Comparison_Operators

Jacques
Comment 2 raal 2017-09-07 16:20:19 UTC
I can confirm with Version: 6.0.0.0.alpha0+
Build ID: e808bbe1ce51465e6f3e9dc4fec2ecd263fe0e4b
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3;
Comment 3 QA Administrators 2018-09-08 02:41:35 UTC Comment hidden (obsolete)
Comment 4 Andreas Heinisch 2020-04-05 19:52:37 UTC
Still confirmed in:
Version: 7.0.0.0.alpha0+ (x64)
Build ID: dbd74393fd0b4d11655e2c4d2676ec1bfebe8923
CPU threads: 6; OS: Windows 10.0 Build 17134; UI render: Skia/Vulkan; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: CL

Code pointer:
https://opengrok.libreoffice.org/xref/core/sc/source/ui/vba/vbarange.cxx?r=9d4c36d7#4338
Comment 5 Andreas Heinisch 2020-04-07 14:48:11 UTC
https://gerrit.libreoffice.org/c/core/+/91834
Comment 6 Commit Notification 2020-07-09 15:10:27 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/59374ea361815b022b1f2a415f995852f23f222e

tdf#107885 - VBA AutoFilter can't compare strings

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2020-07-09 15:17:42 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/978862b99ca7af6a17012084923494b6c85754d5

Use OUString::toChar(), tdf#107885 follow-up

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2020-07-09 19:10:04 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/a7cf65ac009819cb6ae3c08e5fe3f496ef31260a

tdf#107885 - VBA AutoFilter can't compare strings

It will be available in 7.0.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2020-07-10 13:07:23 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e58cab418349a43ea788d0a4f5ba26097b377d2c

tdf#107885: sc_macros_test: Add unittest

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2020-07-15 17:52:32 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f013b5127e3048914d829cf918df2a43f133d108

tdf#107885: sc_macros_test: Add unittest

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.