GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Export grid rows: add a %table placeholder for the output filename · Issue #2662 · HeidiSQL/HeidiSQL

Export grid rows: add a %table placeholder for the output filename #2662

New issue
Copy link
New issue
Copy link
Open
Open
Export grid rows: add a %table placeholder for the output filename#2662
Copy link
Labels
featureA new feature to implementA new feature to implement

Description

@q2apro
q2apro
opened on Nov 6, 2026
Issue body actions

Title: Export grid rows: add a %table placeholder for the output filename

Is your feature request related to a problem?

In "Export grid rows" → Output target "File", I export the same tables over and over (e.g. edu_translations, edu_maps, …) as SQL REPLACEs to sync content between servers. Every time I have to type or pick the filename by hand. The filename field already supports placeholders (%session, %host, %u, %db, %date, %d, %m, %y, %h, %i, %s), but there is no placeholder for the table name, which is the one thing that actually distinguishes one export from the next.

Describe the solution you'd like

A %table placeholder that resolves to the name of the table the grid data comes from, so I can set the filename once and never touch it again:

D:\Exports\%table.sql
D:\Exports\%db_%table_%y-%m-%d.sql

The name should come from the grid itself (GridData.TableName), not from the object selected in the tree, so it also works for query-tab results (SELECT … FROM db.edu_translations), not only for the Data tab. When the result has no single source table (joins, calculated results), fall back to something like UnknownTable, as btnOKClick in exportgrid.pas already does for the SQL/HTML/XML headers.

Implementation hint

exportgrid.pas already has the table name in hand at export time (TableName := GridData.TableName in btnOKClick). It would be enough to replace %table in editFilename.Text with ValidFilename(TableName) before/after the existing GetOutputFilename(editFilename.Text, MainForm.ActiveDbObj) call (lines ~403 and ~696), and to add Result.Values['table'] := _('Table') to GetOutputFilenamePlaceholders in apphelpers.pas so it shows up in the dropdown menu next to the other placeholders. The "Overwrite file?" check and FRecentFiles would keep working unchanged since they operate on the resolved filename / the template respectively.

Describe alternatives you've considered

  • Using the recent-files dropdown: works, but only after the first manual export per table, and the list is limited.
  • %db_%date: produces unique names, but not meaningful ones — I can't tell from the filename which table is in the file.

Environment

HeidiSQL 12.x (current main as of Nov 2026), Windows 11, MariaDB.


Add this to the end of the feature request (or post it as the first comment after creating the issue):


Patch attached

I've attached a patch (heidisql-table-placeholder.patch, git diff against current main, 48aaabb) that implements this. It only touches source/exportgrid.pas:

  • new private GetResolvedFilename that replaces %table with ValidFilename(GridData.TableName) (fallback UnknownTable, same as the existing SQL/HTML/XML headers), then runs the generic GetOutputFilename as before
  • %table added to the filename dropdown menu, local to the grid export dialog — GetOutputFilenamePlaceholders in apphelpers.pas is untouched, so SQL export and the connection log path are unaffected
  • both callers (editFilenameRightButtonClick, btnOKClick) switched to GetResolvedFilename
  • small bugfix on the way: "Open file after creation" called ShellExec(editFilename.Text), i.e. the unresolved template, so it never worked with any placeholder — now opens the resolved Filename

I don't have a Delphi setup here, so the patch is untested but uses only units/functions already in exportgrid.pas (TDBQuery, ValidFilename, StringReplace). Happy to open it as a PR instead if you prefer.

heidisql-table-placeholder.patch

Activity

  1. ansgarbecker
    added
    featureA new feature to implementA new feature to implement
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature to implementA new feature to implement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.