Export a filtered query

I’m trying to export the data as it is filtered on my page.

I tried exporting the same querty that uses the GET values on the page and I just get everything?

I greated a form that creates POST values (using the filters on the page) I can see the data in the text box but when I submit the form the post values are empty??

What am I doing wrong?

Can you explain a little more? Some screenshot? Code?
Export to where? Pdf? Csv?

Are the post values empty, or are they not even part of the post request?
Check the code - the fields need to be inside the form tag to be submitted with the request.
Also, check the network tab in developer tools of browser to verify what data is being submitted on form submission.
Lastly, create a response step with {{$_POST}} as value binding to fetch what the Server Action is receiving in POST body.

export to csv

I’m showing the hidden field here picking up the filtered vanue from the fleet selector

It exports ALL the data not just the filtered data

Fields are inside the form (i used the generator). Network tab shows all data exported.(not filtered) I set up an email to send what is posting and its not picking it up??

Show us the steps under server conect please.
We can’t see how are you doing this

You can just use Response step and check in the response tab. No need to send an email.
If you could share some screenshots of the code, and network tabs… maybe something would stand out.

I’m sorry, I’v actually never used this…I will test (sounds way easier)

I’ll start here, not sure if this is what you are looking for

Is the query returning the filtered results?
The csv is returning no filtered result?
Is that correct?

If that’s the issue, show us the “export csv file” properties.
Are you on stable? Beta channel?

its an internal sit that I update live.

Sorry but I don’t follow you.

You have a query with all the results.
You have a filter on your frontend and you want to use those “filters” to export a csv?

I’m sending the parameters as post values to a query then exporting.

The query is “supposed” to filter the results but the parameters aren’t going through so I get all the data in my csv

I made a test, and seems to be working, check the steps, maybe you’re missing something:

  1. Created an API with a post input “id” (1) then I have a query (Don't use *, select item by item) (2)

  2. Then I have a csv export, that in this case, it will export all the data as no filter was made:

  3. The result:
    image

  4. To make the query be filtered, I go to the condition tab (1) set a condition (2) and I use the same post value (3)

  5. In my page I have a simple form that sends the id (Set post and select the server connect):

  6. The text input need to have the name “id” (same as the post input of the api)

  7. I test with the value “1” so in this case will only return when user id = 1


    You can see also the query because it has an output option.

  8. Now the result is this:

I am not sure i understand what is going on here :slight_smile: and why are all these complicated things suggested.

All you need to do is to use the same filters you are using for listing the records on the page also in the export server action, filter the db query, then run the export step using this query.

Wow, thanks for the time on this. Let me try and post what I have as I’m pretty sure I’m doing it as youdescribe. I think my problem lies in how I get the POST values.

Originally I was using the “GET” values from the database that displayed them on the page. After all if the back end is filtering the data to display why can’t I just trigger it to do an export of the displayed values.

That went nowhere so I set up a seperate server connection just to export and then used a form that gets POST values from the same filters. I think I need to go back to plan a?

Please understand that it’s difficult to us when we don’t really see how is the filter made.
We need to see some screenshot or some code.

If you’re using GET, check the query first, and how it’s retrieving the values.
All indicates that the problem is not the csv export thing.


You can check the query [ I see it has the output option enabled (image )]

  1. Go to your page, press F12 (or inspect) Then go to network (1) and select all (2)
  2. Submit the form and you will see the result.
    Select the API (1) and click payload (2) Now we see the value has been sent (3)
  3. We go to preview (1) and wee see the result of the query (2)

Please, provide all the screenshots you can, step by step, how all it’s made

Permanent filter is chosen (showing P in the (unhidden) Post field export field
image
FleetFilt shows no value despite the P in the text box. The Shop filter is picked up (its hidden)
image
csv is generated but has all units (not even just shop)

Here is the maint by filt in the query

image
Payload picked up both