Visual Builder

Get Involved. Join the Conversation.

Topic

    HARSHA VARDHAN PULAKUNTA JANARDHAN
    Export to CSV/Excel functionality on VBCSAnswered
    Topic posted August 29, 2019 by HARSHA VARDHAN PULAKUNTA JANARDHANGreen Ribbon: 100+ Points 
    25 Views, 3 Comments
    Title:
    Export to CSV/Excel functionality on VBCS
    Summary:
    Export to CSV/Excel functionality on VBCS downloads Empty file on the first click
    Content:

    I have created a array data provider(ADP) which fetches data based on the parameters passed in  the page. there is export button which download the data from the ADP. When i click for the first time it downloads empty file , then when i click on second time it downloads data. I have a event triggered when clicked to fetch the data from service connection to ADP var. unfortunately file is downloaded before the data is fetched hence every other click i will get old data. Please help

    Best Comment

    Duncan Mills

    The export component just asks the data provider for whatever rows it has, so perhaps you should not show the export component at all until you have set up the parameters and have all the data you need.

    Alternatively you can pass a plain array of data to the export component and that is what it will write to the export - it sounds like that is what you actually need in your case 

    Comment

     

    • Duncan Mills

      The export component just asks the data provider for whatever rows it has, so perhaps you should not show the export component at all until you have set up the parameters and have all the data you need.

      Alternatively you can pass a plain array of data to the export component and that is what it will write to the export - it sounds like that is what you actually need in your case 

      • HARSHA VARDHAN PULAKUNTA JANARDHAN

        Hi,

        Once i click export i have a event which will make a rest call and fetch the data to array data provider. before the rest fetches data/ or the event getting triggered the file is getting downloaded. How can i make the export download the file after the array data provider is populated. i cannot go for two button action as client wants only one button. 

         

        in two button first button will populate data provider and second will download the file. can we achieve in single click

         

        Regards,

        Harsha Vardhan

    • Duncan Mills

      You can programatically call the same data export function from a PageModule function so you are able to create your own button that calls your own Action Chain that  does the relevant setup of the data provider or array and then calls that module function to do the actual export. 

      If you look at the readme for the component -  which you can view by selecting the component in the components side tab (the puzzle piece) it provides you with a code snippet. Read the section Using the Export Capability in Headless Mode.

      The workingAreaId is just the ID of a DOM element (e.g. a div) that you need to create in the page for the exporter to use.  It can have a style of display:none;