Skip to content

Hidden property doesn't work as expected. #244

Open
@dev-mkc19

Description

@dev-mkc19

Hi. Release 0.10 brought ability to get status of field, either it hidden or not. But in fact Tableau workbook doesn't contain xml attribute for every field, only for hidden. So after initialisation Workbook object if you check fields you will see two values False or None.

But code and docstring inside hidden method tells that as a user I should expect only True False values. Am I right that it's a bug and None values have to be handled?

Code to reproduce:

import tableaudocumentapi
wb = tableaudocumentapi.Workbook('CheckBook_2021.2_sql.twb')
import pandas as pd

fs = []
for s in wb.datasources:
    for k in s.fields:
        try:
            id = s.fields[k].id
        except:
            pass
        try:
            name = s.fields[k].name
        except:
            pass
        try:
            caption = s.fields[k].caption
        except:
            pass
        try:
            calculation = s.fields[k].calculation
        except:
            pass
        try:
            hidden = s.fields[k].hidden
        except:
            pass


        fs.append({'ds': s.caption,
                    'id': id,
                'name': name,
                'caption': caption,
                'calculation': calculation,
                'hidden': hidden
                    })
df = pd.DataFrame.from_records(fs)
df

Result:
image

CheckBook_2021.2_sql.twb.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions