Topic: Version 6.3

Version 6.3
http://myvisualdatabase.com/download/myvisualdb.exe


What's new?

• Added a new function ExportAllToCSV, now you can export whole the database to csv files


   Function parameters

function ExportAllToCSV(Path: string; OverwriteIfExists: boolean = True; ShowProgress: boolean = False; FirstRowFieldsName: boolean = True; Separator: string = '',''; Enclosing: boolean = True; EndOfLine: TCsvEndOfLine = ceCrLf): boolean;

   example

if ExportAllToCSV('e:\temp\') then ShowMessage('Done') else ShowMessage('Error');


• Added a new function ExportToCSV, now you can export SQL result to csv file

   Function parameters

function ExportToCSV(FileName: string; SQL: string; ShowProgress: boolean = False; FirstRowFieldsName: boolean = True; Separator: string = ','; Enclosing: boolean = True; EndOfLine: TCsvEndOfLine = ceCrLf): integer

   example

procedure Form1_Button5_OnClick (Sender: TObject; var Cancel: boolean);
var
    i: integer;
begin
    i := ExportToCSV('d:\123.csv', 'SELECT id, lastname, firstname FROM employees');
    ShowMessage('Exported ' + IntToStr(i) + ' records.');
end;


• Added a new class Application.User, to access current user properties

   the following properties are available

Application.User.id;
Application.User.Username;
Application.User.Email; 
Application.User.First_name; 
Application.User.Last_name; 
Application.User.Role; 
Application.User.RoleId; 
Application.User.is_admin; 
Application.User.is_active;
Application.User.is_logged; 
Application.User.Last_login; 
Application.User.Date_joined;

• Now you can specify for a ComboBox component sorting order, using properties "SoftField" and "SortOrder" via Object Inspector.
• Added two new methods for Image component: function PasteBitmapFromClipboard: boolean and function CanPasteBitmapFromClipboard: boolean
• Added a new event OnAfterEdit for TableGrid component
• Added a new method ScaleBy for Form
• Fixed some bugs

Dmitry.

2 (edited by prahousefamily 2020-03-17 07:20:45)

Re: Version 6.3

function ExportToCSV
how to set
- text Qualifier ?
- Separator by tab ?
- Format value date,datetime or float,integer ?

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: Version 6.3

prahousefamily wrote:

function ExportToCSV
how to set
- text Qualifier ?
- Separator by tab ?
- Format value date,datetime or float,integer ?

Separator you can specify by parameter of the function "Separator"
According rfc4180 text Qualifier is double quotes, you can't change it.

for date and datetime used default format for SQLite and MySQL (YYYY-MM-DD HH:MM:SS)
for float values, used a symbol dot as decimal separator.

function ExportToCSV(FileName: string; SQL: string; ShowProgress: boolean = False; FirstRowFieldsName: boolean = True; Separator: string = ','; Enclosing: boolean = True; EndOfLine: TCsvEndOfLine = ceCrLf): integer
Dmitry.

Re: Version 6.3

Is there a simple way to ask the user for the file path and name of his/her choice via an explorer window instead of having a fixed path for "FileName"?

Re: Version 6.3

var
    SaveDialog: TSaveDialog;
begin
    SaveDialog := TSaveDialog.Create(Form1);
    SaveDialog.Filter := 'CSV file|*.csv';
    saveDialog.DefaultExt := 'csv';

    if SaveDialog.Execute then
    begin
      ShowMessage('Filename ---> '+saveDialog.FileName);      // show path and filename
    end;
    saveDialog.Free;
end;

6 (edited by Destiny 2023-12-09 15:16:01)

Re: Version 6.3

Now it's 6.5

Destiny

Re: Version 6.3

I know about the version, I was talking about the new "export to CSV" feature and wanted a way to ask the user where he wants to save the file via the scripts above instead of having a handwritten path in the script. I al still working on how to include Sparrow's answer to the function / procedure written by Drivesoft, that's because I am still a bit slow in the Pascal side smile