Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am unable to extract more than 10k rows using Tableau extension library #563

Open
abhigrazitti opened this issue Oct 15, 2024 · 0 comments

Comments

@abhigrazitti
Copy link

abhigrazitti commented Oct 15, 2024

I am using tableau extension library version tableau.extensions.1.10.0.js.

I am unable to extract more than 10k rows

This is the function which I have created for data extraction.

async function getUnderlyingDataFromAllDataSources() { try { appendMessage("Starting to fetch underlying data from Tableau..."); const dashboard = tableau.extensions.dashboardContent.dashboard; appendMessage(Dashboard name: ${dashboard.name}`);

            const worksheets = dashboard.worksheets;
            appendMessage(`Number of worksheets: ${worksheets.length}`);

            let allData = [];

            for (let worksheet of worksheets) {
                appendMessage(`Processing worksheet: ${worksheet.name}`);
                
                try {
                    const dataSource = await worksheet.getDataSourcesAsync();
                    appendMessage(`Data sources for ${worksheet.name}: ${dataSource.length}`);

                    const options = {
                        maxRows: 0,
                        ignoreSelection: true,
                        includeAllColumns: true
                    };

                    const underlyingData = await worksheet.getUnderlyingDataAsync(options);
                    
                    const data = underlyingData.data.map(row => {
                        let rowData = {};
                        underlyingData.columns.forEach((col, index) => {
                            rowData[col.fieldName] = row[index].formattedValue;
                        });
                        return rowData;
                    });

                    appendMessage(`Processed ${data.length} rows from ${worksheet.name}`);
                    allData = allData.concat(data);

                } catch (error) {
                    appendMessage(`Error processing worksheet ${worksheet.name}: ${error.message}`);
                }
            }

            appendMessage(`Total data rows collected: ${allData.length}`);

            if (allData.length === 0) {
                appendMessage("No data was retrieved from any worksheet. Please check your Tableau dashboard and permissions.");
                return;
            }

            const result = await response.json();
            appendMessage(`Backend response: ${JSON.stringify(result)}`);
            appendMessage('Data sent to backend successfully.');
            
        } catch (error) {
            appendMessage(`Error in getUnderlyingDataFromAllDataSources: ${error.message}`);
        }
    } `
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant