document-api-python
document-api-python copied to clipboard
Nested Calculated Field Name
If the calculated field formula contains another calculated field, the name can not be displayed correctly.
It will display as "Calculation_..." instead of the calculated field name.
@jacalata Hi. Wanna to fix this. Which way for implementing is preferable? I suggest to replace fields' id to fields' name/caption at endpoint (datasource.calculations line:295), because it's good place where you have entire dict of fields and it's easy to iterate through it. So whenever you call datasource class it will return correct calculations but underhood it steel remain working with real xml. Am I right? What do you think?
Hmm, I'm not sure exactly what the problem is. I have a datasource where the XML looks like this
<column caption='calculation level 1' datatype='string' name='[Calculation_2467128183716855808]' role='dimension' type='nominal'>
<calculation class='tableau' formula='[Acct Name]' />
</column>
<column caption='calculated nesting calculation' datatype='string' name='[Calculation_2467128183716900865]' role='dimension' type='nominal'>
<calculation class='tableau' formula='[Calculation_2467128183716855808]' />
</column>
<column caption='Calculation1' datatype='string' name='[Calculation_2467128183746195458]' role='dimension' type='nominal'>
<calculation class='tableau' formula='STR([Burst Out Join]) + str([Calculation_2467128183716900865] )' />
</column>
<column caption='SHOW' datatype='string' name='[Calculation_88946136969252864]' role='dimension' type='nominal'>
<calculation class='tableau' formula='IF [BurstoutSet] THEN "Selected" ELSE "Not Selected" END' />
</column>
When I iterate through it with the show_fields sample, I get this, which looks reasonable to me. What's the output that you would prefer?
3: field named calculation level 1
is a string
field id: [Calculation_2467128183716855808]
field caption: calculation level 1
field calculation: [Acct Name]
4: field named calculated nesting calculation
is a string
field id: [Calculation_2467128183716900865]
field caption: calculated nesting calculation
field calculation: [Calculation_2467128183716855808]
5: field named Calculation1
is a string
field id: [Calculation_2467128183746195458]
field caption: Calculation1
field calculation: STR([Burst Out Join]) + str([Calculation_2467128183716900865] )
From programmer's side it's ok to see fields' ids in formula, but others users / bi engineers / analysts have habit to see fields' names / captions because they work with it. Interface provide poor capability to see ids. I know only 2 methods: on datasource pane when changing view to fields’ list not preview and perhaps in describe field from context menu by mouse clicking on field. So this is uncomfortable way, you won’t have enough patience to matching ids with captions each time. On other side when you create calculations, Tableau provide autocomplite feature with names / captions. Thats why others operate by names / captions instead of ids. More then that Tableau metadata API return correct formulas with captions. Based on descriprion above I prefer to mark this issue as a bug and it would be cool to fix it.