Giving Users a Save As Dialog Box

Giving Users a Save As Dialog Box

Question:
I am creating a CSV file from a table via the export command and would like to give the user the option to name the CSV file at execution time via some type of Save As dialog box.

Answer:
There is a VFP function called PUTFILE() which calls up a Save As dialog box:

 PUTFILE([cCustomText] [, cFileName] [, cFileExtensions])

  • cCustomText is the text you want to appear next to the chosen filename on the dialog box.
  • cFileName is a default file to pre-select.
  • cFileExtensions is a semicolon-delimited string of file extensions, telling the dialog box which file extensions to show in the Save As dialog box.

The following line of code calls the standard Save As dialog box:

lcFile = PUTFILE()

The following line of code calls the Save As dialog box with “Export To:” next to the file selected, defaults to “Rick.Txt”, and shows only TXT and DBF files:

lcFile = PUTFILE("Export To:","Rick.Txt","TXT;DBF")

PUTFILE() does not save anything; it merely returns the name of the file selected.

To solve your problem, try the following:

 lcCSVFile = PUTFILE("Export File:","","CSV")EXPORT ALL TO (lcCSVFile)

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several