tableau / extensions-api

Extensions API sample code and developer docs.
http://tableau.github.io/extensions-api
MIT License
268 stars 251 forks source link

Extensions and MeasureNames #243

Closed tb582 closed 1 year ago

tb582 commented 5 years ago

I have a quick extension but I'm not seeing all the values I'd expect with getting summary data .... some of the 'measure names' show up like

"Measure Names":"[federated.046k1331msvlds18os0bt1p7zpww].[usr:Calculation_166422086083043330:qk]"

How can I tie this back to something within the tableau UI ?

Assuming I have to rename something but I don't have any calculated fields with the name(s) above.

johnDance commented 5 years ago

Hello! Normally the UI will show you the caption rather than the official field name. Are you looking at a Field object? If so, you should be able to get both it's Id, which would be something like you have above, and its name, which should be the caption that you see in the UI.

But it sounds like you are looking at the results of getSummaryDataAsync, which should give you the name. Is it possible to share the workbook, either here, or privately? John

tb582 commented 5 years ago

@johnDance send you an email to your tableau email (if I got it right)

johnDance commented 5 years ago

You guessed correctly. đź‘Ť

johnDance commented 5 years ago

@tb582 gave me a little background information. Here is what we discovered...

When you put “Measure Names” on the shelf, the data of that are the names of your measure fields. That is what you are seeing in the values in GetSummaryDataAsync. Since the fields like GAP, and others are calculated fields, the value is the field name (actually field id) of the calculated field.

[federated.046k1331msvlds18os0bt1p7zpww].[usr:Calculation_166422086083043330:qk]

As you mention, this isn’t very helpful if you really want to know what field that is. You can find the field caption (which is what you see in the UI), in datavalue.formattedValue.

In datavalue.value, you get the fieldID, and in datavalue.formattedValue, you get the caption (or user friendly name).

If you want to tie this back to an actual field, you can get the fields in your datasource, and compare datavalue.value against field.id, or datavalue.formattedValue against field.name.

John

tjallingt commented 5 years ago

seems like another reason we might want fieldId on Column https://github.com/tableau/extensions-api/issues/207

johnDance commented 5 years ago

Thanks for the link. I've added that issue to our internal issue tracker.

johnDance commented 1 year ago

The fieldId is now part of the column information. This is since 1.5.