[Solved] Where is my filter?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
User avatar
Mr.Dandy
Posts: 461
Joined: Tue Dec 11, 2012 4:22 pm

[Solved] Where is my filter?

Post by Mr.Dandy »

I don't understand where is located the filter.
In the attached document, I was apply a filter but unable to find it in ThisComponent tree.
The DatabaseRanges.Count property returns 0 :roll:

Thanks
Attachments
sample_filter.ods
(10.63 KiB) Downloaded 11 times
Last edited by Mr.Dandy on Thu May 22, 2025 8:56 am, edited 1 time in total.
OpenOffice 4.1.12 - Windows 10
User avatar
Mr.Dandy
Posts: 461
Joined: Tue Dec 11, 2012 4:22 pm

Re: Where is my filter?

Post by Mr.Dandy »

I must have misspoken.
I'm not trying to un/filter through the UI, but to retrieve the filter description I defined via the API.
OpenOffice 4.1.12 - Windows 10
FJCC
Moderator
Posts: 9563
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Where is my filter?

Post by FJCC »

If I do the following steps in MRI

Code: Select all

  oDatabaseRanges = ThisComponent.DatabaseRanges
  oObj1 = oDatabaseRanges.getByName("__Anonymous_Sheet_DB__0")
  oFilterDescriptor = oObj1.getFilterDescriptor()
  
  oFilterFields = oFilterDescriptor.getFilterFields()
I see the the following properties in the FilterFields

Code: Select all

(Name)        (Value Type)             (Value)  (AccessMode)
(0)
Connection    .sheet.FilterConnection  OR     
Field         long                     0      
Operator      .sheet.FilterOperator    EQUAL  
IsNumeric     boolean                  False  
NumericValue  double                   0.0    
StringValue   string                   A      
(1)
Connection    .sheet.FilterConnection  AND    
Field         long                     1      
Operator      .sheet.FilterOperator    EQUAL  
IsNumeric     boolean                  True   
NumericValue  double                   12.0   
StringValue   string                   12     
Is that what you are looking for?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Mr.Dandy
Posts: 461
Joined: Tue Dec 11, 2012 4:22 pm

Re: Where is my filter?

Post by Mr.Dandy »

Thanks FJCC for the hint

But that's work only with OpenOffice.
LibreOffice returns an empty DatabaseRanges object.
I found an issue report with 147257
I must use :

Code: Select all

oUDR=ThisComponent.getPropertyValue("UnnamedDatabaseRanges")
:knock:
OpenOffice 4.1.12 - Windows 10
Locked