question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

filter method getFieldAsync does return 401 on super store example

See original GitHub issue

Description

I have faced an issue where I wanted to get the field that was used for a filter. For this I found in the API reference this method getFieldAsync(). But instead of returning the field object, I always get unauthorized response, even though everything else from the API does work.

What I am using

Workbook: SuperStore - Shipping

My implementation

export async function getColumnRoles(worksheet: Worksheet): void {
  let metaInfo: any = {};
  const filters = await worksheet.getFiltersAsync();
  console.log(filters);
  // This gives me the error 
  console.log(await filters[0].getFieldAsync());
}

Request (simplified)

Request URL: [...]/w/Superstore/v/Shipping/sessions/A3093F7D1A1D4B409E9D8146FC983557-0:0/commands/tabdoc/get-datasource-pres-model
Request Method: POST
Status Code: 401 
Remote Address: [...]
Referrer Policy: strict-origin-when-cross-origin

My goal in the end is to find out whether the filter is assigned to a field which is a dimension or measure

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
LingVuDevcommented, Jun 17, 2021

Still getting a 401 on the latest extension version 1.5.0. I am using exactly this code snippet:

const worksheets = await tableau.extensions.dashboardContent.dashboard.worksheets.forEach(
    async (worksheet: Worksheet) => {
      const filters = await worksheet.getFiltersAsync();
      filters.forEach(async (filter) => {
        const field = await filter.getFieldAsync();
        console.log(field);
      })
    },
  );
Screenshot 2021-06-17 at 09 32 35
1reaction
johnDancecommented, Apr 13, 2021

Hello @LingVuDev We have recently found and fixed an issue with Filter.getFieldAsync(). It will be fixed in our upcoming 1.5 version of the extension library (coming in Q2). Meanwhile, the only work-around would be to use Filter.fieldId, and look up the field in DataSource.fields. From that field, you can get the role. John

Read more comments on GitHub >

github_iconTop Results From Across the Web

Return HTTP Error 401 Code & Skip Filter Chains
If you return from the method after setStatus that stops further processing of the request. The filter chain only proceeds if you call...
Read more >
Managing Server User Filters With A Dedicated User File
User filters on Tableau server are an excellent way to control individual access to certain information. These filters may be applied to specific...
Read more >
Untitled
Do -35 package dimensions, 3ds qr codes gold pants, Greenray inc, Romanian wasr ... Mustafa karahan randevu, Aeon mall phnom penh supermarket, Global...
Read more >
Untitled
Hemmemawei, Fantozzi pantaloni ascellari, Do it shia palpatine, ... Getfileasync example, Male police officer costume, First direction concert, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found