document-api-python icon indicating copy to clipboard operation
document-api-python copied to clipboard

Hidden property doesn't work as expected.

Open dev-mkc19 opened this issue 2 years ago • 0 comments

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

dev-mkc19 avatar Nov 12 '22 12:11 dev-mkc19