embedding-api-v3-guide
embedding-api-v3-guide copied to clipboard
Retrieve Relevant Values for Any Column
Currently in the v2 API in order to filter against a workbook, you can set any field in the dataset regardless of the makeup of the worksheet/dashboard you're filters. So for instance, if I run
worksheet.applyFilterAsync("Product Type", "Coffee",
tableau.FilterUpdateType.REPLACE);
it will apply the filter regardless of whether or not Product Type is on my filter shelf. However, if Product Type is on my filter shelf and, for instance, set as a context filter, it will take that into account and apply the filter in context. This flexibility is extremely useful so I would appreciate if it can stay!
However, when retrieving filter values this "ask for any filter" approach does not work. When running worksheet.getFiltersAsync() it only retrieves filters that have been set up in Tableau Desktop/Web-edit (understandably) or applied via the JS API.
Will there be a method available to retrieve relevant values for columns that haven't been added to the worksheet's filter shelf? Either a worksheet.getColumnValuesAsync("Product Type") or filtering the underlying data to specific columns (since this column may not exist on my level-of-detail as well)
Would your proposed worksheet.getColumnValuesAsync() get all values or only the unique items in said column? The latter would make it really useful and easy for creating custom filters in your web app.
Yes, ideally it would retrieve the equivalent of a “SELECT DISTINCT” for the column. I would imagine that this would need to be a worksheet method, but a dashboard method would be very convenient
Basically you want Field.getDomainAsync (and you want to be able to get all Fields and filter to the specific one you're interested in). Is that inline with your idea? By the way, we have Filter.getDomainAsync in the Extensions API: https://tableau.github.io/extensions-api/docs/interfaces/categoricalfilter.html, but as you're pointing out that's only if the Filter has been applied.
I definitely like this idea. If you agree with my Field.getDomainAsync idea, I will put in on the backlog.
Incredible. Yep, exactly, Field.getDomainAsync()!