Skip to main content
1-Visitor
March 2, 2017
Solved

Export DataExport specify name of file ?

  • March 2, 2017
  • 1 reply
  • 6920 views

Hey all,

1-

     When using the thing DataExport to export a data table, is there a way to specify the name of the exported file ?

     As of now it only creates file with the name : "Export+DateTime".xlsx

     Is there a way I could use a custom name like "VendingMachineData.xlsx" ?

2-

     Is there a way to get only the file name upon ExportInfoTableAsExcel ?

     I guess I could write down a service that get the name starting from the last "/"

Frederik

Best answer by fgrondin

Ok,

I found a work around to name the export file, but I don't think it's a "good" work around because I'm hard coding stuff,

So basically, I have a textbox, which the user set a name for the file.

Then, when the user click on export data, the service ExportInfotableAsExcel will be call, and then the service renameFile will be call on serviceCompleted.

The path in renameFile is hardcoded since the ExportInfotableAsExcel export the file in a static folder.

So, I just right down /nameofFile.xlsx and rename it right away.

1 reply

20-Turquoise
March 2, 2017

1. Currently cannot specify the export name.

2. Could you please clarify the question? I.e desired result vs current?

fgrondin1-VisitorAuthor
1-Visitor
March 2, 2017

When using the service "ExportInfotableAsExcel" the result of that is the path of where it'll be stored at (repository\DataExporterRepository\Export2017-03-01_16-55-24.xlsx).

And in that result, there is the name of that file which is Export2017-03-01_16-55-24.xslx

Is there a way to get only the name of the file with the extension (.xlsx) ?

Like I said the only way I can figure out how to do it right now would be to write down a script that remove the other stuff.

So basically, I would want the name of the file when it's created, so I can filter the grid that contains the data from FileRepository.GetFileListingWithLinks
in order to get only that file in the grid.

20-Turquoise
March 2, 2017

These is how those services work and they are not editable. Your approach would probably make the most sense for that situation. You may either remove the text prior to \Export.. or perhaps have a variable/counter/prime key to keep track of the exported files.