Building a report on screen/web app

Hi Guys,

Please can you assist me with an approach to my intended result?

I have built a dashboard before with PHP and the database was filled with all relevant data, I could display data in a pre-determined table grid but I had the “stage/phase” selected in a drop-down select and that would display the required stage/phase for all records on the database in a report form which could be exported via excel?

I want to do the same thing on the Wappler node.js approach but I’m struggling to get the DB API and the dropdown to work together.

basically what I need is to select the the option from the dropdown that would represent the stage/phase of the records on the DB and only display that selected stage/phase and then export that list to Excel or pdf etc.

Please if there is more info needed please shoot me a reply.

Hi Rudolf,

To show data in the grid on a selection of one of the options, you can add a dynamic event dmx-on:click to the button element and load the DB API by sending the selected value stage or phase to the DB API via a GET parameter. So, the steps witll be:

  1. Add a GET parameter in the DB API. Let’s call it selected_option.
  2. Add a condition in the DB API to filter the relevant table field with this parameter selected_option
  3. In the UI, add a dynamic click event on the button element, add an action step to load the DB API by providing value of the select element to the selected_option parameter.
1 Like

Actually you can bind the value of the select directly to the server connection parameter and refresh will be automatic, no need for updated() event.
Basically this is no different to filtering any list, be it text or select

3 Likes

This works perfectly gentlemen, I wish to export that called data in the data table with a click of a button.

I know I can use the export to csv function but how would I go about it?

I think my approach is wrong here.

*Edit
I tried a few other options I scanned the community topics, and I managed to pull a different API with the csv export but I get this error?

Hey, I can see that the query is executed under a condition, so, is that condition aplied when you export the csv?

I haven’t worked with csv for a long time, but, why don’t you run the same query previously to the export csv step and see if that works?
Or as a separated api.

PS: you can paste the error text here for a better reading:

Hi Rudolf,

The CSV export step and exportable data are in two different conditions. Add the data query step in the export condition and then select that query to export. The data query to export will also need to contain the same conditions, if required, as the normal query to match with data on the front-end. You may also want to enable contains header option to export field/column names along with the data.

I also noticed in the screenshot you have added Security identity. This can be added under Globals and it will become available in all the APIs. To add this, click on Globals and add a new step Security Identity under Execute.