In Script MVD have good function (Mathematical,Other ) and easy to use but in report script have not
how to copy function in MVD To report or create custom function

My Visual Database → Posts by prahousefamily
In Script MVD have good function (Mathematical,Other ) and easy to use but in report script have not
how to copy function in MVD To report or create custom function

Thank You Dmitry.
For Fix Error And Easy use Stringlist in this problem
For MVD Community can download "bug_report.fr3" replace original Fix Error

Script Fix
var
//sum
sList: TStringList;
si: Integer;
//count
cList: TStringList;
ci: Integer;
//max
xList: TStringList;
xi: Integer;
//min
yList: TStringList;
yi: Integer;
procedure GroupHeader1OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass then
if ValidInt(sList[si]) then
Memo5.Text := 'SUM = '+FormatFloat('#,##0', StrToFloat(sList[si]));
if Engine.FinalPass then
if ValidInt(cList[ci]) then
Memo10.Text := 'COUNT = '+(cList[ci]);
if Engine.FinalPass then
if ValidInt(xList[xi]) then
Memo4.Text := 'MIN = '+FormatFloat('#,##0', StrToFloat(xList[xi]));
if Engine.FinalPass then
if ValidInt(yList[yi]) then
Memo11.Text := 'MAX = '+FormatFloat('#,##0', StrToFloat(yList[yi]));
end;
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
if not Engine.FinalPass then sList.Add(FloatToStr(SUM(<Report."population">, MasterData1)));
Inc(si);
if not Engine.FinalPass then cList.Add(FloatToStr(count(masterdata1)));
Inc(ci);
if not Engine.FinalPass then xList.Add(FloatToStr(MIN(<Report."population">,MasterData1)));
Inc(xi);
if not Engine.FinalPass then yList.Add(FloatToStr(MAX(<Report."population">,MasterData1)));
Inc(yi);
end;
procedure frxReportOnStartReport(Sender: TfrxComponent);
begin
sList := TStringList.Create;
cList := TStringList.Create;
xList := TStringList.Create;
yList := TStringList.Create;
end;
procedure frxReportOnStopReport(Sender: TfrxComponent);
begin
sList.Free;
cList.Free;
xList.Free;
yList.Free;
end;
procedure Page1OnBeforePrint(Sender: TfrxComponent);
begin
si := 0;
ci := 0;
xi := 0;
yi := 0;
end;
begin
end.Thank You Dmitry. Again
This Example Now use Ctrl+V only can not use right click Paste
How To Use This Effect
Step 1 Check Form Event
Step 2 Check Script (Next Example I try modify script support Field more 2)
Setp 3 - 4 Copy and Use Ctrl+V
Printing a group sum in the group header
https://www.fast-report.com/documentati … header.htm
But Get Error summary miss group
Summary Group Header Group(1) To Group(2)
....
Summary Group Header Group(Last) To Group(1)
procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
begin
Set('S', Sum(<Report."population">));
end;
procedure Memo5OnBeforePrint(Sender: TfrxComponent);
begin
if Engine.FinalPass then
Memo5.Text := FormatFloat('0,000',Get('S'));
end;
begin
end.
I want to copy value from excel to tablegrid and insert to table in database ...
excel --> tablegrid --> database
help increase speed when input data
I think try use function clipboardget and splitter string but
i don't know use even at tablegrid ???
How To Copy All Value From Excel To Grid in MVD By Ctrl+C ,Ctrl+V

How To Setting Font Default All Component In MVD ?
Font Name
Font Size
in Component
Button
TextBox
Memo
Richedit
Combobox
Checkbox
Dattimepicker
Tablegrid
Treeview
Groupbox
PageControl
Requirement add line number in Tmemo please ! look like script edit
reference From
http://www.schoolfreeware.com/Free_Pascal_Lazarus_App_GUI_Tutorial_12.htmlFree Pascal Lazarus App Tutorial 12 - System Timer Bouncing Ball Animation - Shapes
A shape is added to the form. The shape is made into a circle, resized and colored red with the brush. A timer is added to allow the shape to move around the form. When the shape hits the side of the form the ball will bounce of the form’s side.
I try code to MVD and change Tshape To Panel
Look Little Funny Time
Screen Short
Open Code
var
Timer: TTimer;
procedure Form1_OnShow (Sender: string; Action: string);
begin
Timer := TTimer.Create (nil);
Timer.OnTimer := @OnTimer;
Timer.Interval := 10;
Timer.Enabled := True;
end;
procedure OnTimer;
var
G_Right: Boolean;
G_Up: Boolean;
R_Right: Boolean;
R_Up: Boolean;
Y_Right: Boolean;
Y_Up: Boolean;
begin
if G_Up = True then
Form1.Panel1.Top := Form1.Panel1.Top - 2
else
Form1.Panel1.Top := Form1.Panel1.Top + 2;
if G_Right = True then
Form1.Panel1.Left := Form1.Panel1.Left + 2
else
Form1.Panel1.Left := Form1.Panel1.Left - 2;
if Form1.Panel1.Top <= 0 then
G_Up := False;
if Form1.Panel1.Top + Form1.Panel1.Height >= Form1.Height then
G_Up := True;
if Form1.Panel1.Left <= 0 then
G_Right := True;
if Form1.Panel1.Left + Form1.Panel1.Width >= Form1.Width then
G_Right := False;
if R_Up = True then
Form1.Panel2.Top := Form1.Panel2.Top - 4
else
Form1.Panel2.Top := Form1.Panel2.Top + 4;
if R_Right = True then
Form1.Panel2.Left := Form1.Panel2.Left + 4
else
Form1.Panel2.Left := Form1.Panel2.Left - 4;
if Form1.Panel2.Top <= 0 then
R_Up := False;
if Form1.Panel2.Top + Form1.Panel2.Height >= Form1.Height then
R_Up := True;
if Form1.Panel2.Left <= 0 then
R_Right := True;
if Form1.Panel2.Left + Form1.Panel2.Width >= Form1.Width then
R_Right := False;
if Y_Up = True then
Form1.Panel3.Top := Form1.Panel3.Top -3
else
Form1.Panel3.Top := Form1.Panel3.Top +3;
if Y_Right = True then
Form1.Panel3.Left := Form1.Panel3.Left +3
else
Form1.Panel3.Left := Form1.Panel3.Left -3;
if Form1.Panel3.Top <= 0 then
Y_Up := False;
if Form1.Panel3.Top + Form1.Panel3.Height >= Form1.Height then
Y_Up := True;
if Form1.Panel3.Left <= 0 then
Y_Right := True;
if Form1.Panel3.Left + Form1.Panel3.Width >= Form1.Width then
Y_Right := False;
end;
procedure Form1_OnClose (Sender: string; Action: string);
begin
Timer.Free;
end;
begin
end.I try Example in http://wiki.freepascal.org/TComboBox
But Error
I will to display like example 
It hard code ! Who is can edit .... help me please again !
It can show multiple column BUT Can Not Show Image !
Help Me Please again!
I try more code but error for insert image or column with combobox like picture below
Help Me Please !


Wow It Beautiful beautiful component It good teach my student ...
Have a little question
1 Can you add Symbol Or Equation in Richedit?
2 If you save in Richedit format, the text style is highlighted. Insert color if you want to display Richedit only or can use Memo instead?
Compile MVD 4.6 +++
Knowledge In This Example
- button can change caption or icon from value database
- can apply save setting insert to database and load value quick time program open
Happy Everybody MVD!
Screen Shot
Open Code
var
listview : Tlistview ;
ImageList: TImageList;
i : integer ;
sl: TStringList;
ci : integer ;
procedure Form1_TableGrid1_OnChange (Sender: TObject);
var
ti : integer ;
begin
For ti := 0 to Form1.controlCount -1 do
Begin
IF (Form1.controls[ti] is TButton) then
Begin
TButton(Form1.Controls[ti]).caption :=
SQLExecute('SELECT caption from button where ci = '+IntToStr(ti));
TButton(Form1.Controls[ti]).images := ImageList ;
TButton(Form1.Controls[ti]).imageindex :=
SQLExecute('SELECT imageindex from button where ci = '+IntToStr(ti));
End;
End;
end;
begin
ImageList:=TImageList.Create(Form1);
ImageList.Masked:=false;
ImageList.ColorDepth:=cd32bit;
ImageList.Width := 16;
ImageList.Height := 16;
sl := TStringList.Create;
sl.Text := GetFilesList(ExtractFilePath(Application.ExeName)+'icon','*.png');
For i := 0 To sl.count-1 Do
Begin
ImageList.AddPng(sl[i]);
end ;
listview := Tlistview.Create(Form1);
listview.Parent := Form1.Panel1;
listview.Align := alClient;
listview.StateImages := ImageList;
listview.smallimages := ImageList;
listview.Largeimages := ImageList;
listview.GridLines := True;
listview.viewStyle := vsreport ;
listview.Columns.add();
listview.Columns.add();
listview.Columns[0].caption := 'Icon : Name' ;
listview.Columns[1].caption := 'Imageindex' ;
listview.Columns[0].AutoSize := True ;
listview.Columns[1].AutoSize := True ;
For i := 0 To sl.count-1 Do
begin
with ListView.Items.Add do
begin
ImageIndex := i;
Caption := ' : '+replacestr(sl[i],ExtractFilePath(Application.ExeName)+'icon\','');
SubItems.Add(IntToStr(i));
end;
end;
For ci := 0 to Form1.controlCount -1 do
if (Form1.controls[ci] is TButton) then
begin
SQLExecute('INSERT INTO button(name,caption,imageindex,ci) values ('+
'"'+TButton(Form1.Controls[ci]).name+'",'+
'"'+TButton(Form1.Controls[ci]).caption+'",'+
'"'+IntToStr(TButton(Form1.Controls[ci]).imageindex)+'",'+
'"'+IntToStr(ci)+'" );');
End;
end.Knowledge In This Example
- MySQl SQL Syntax,
"Show tables"
"Show Create Table xxx"
- Tdaset : use loop auto generate ddl in table result
Concat("Show tables","Show Create Table xxx")
- Tprogressbar
show status countdown all process
- Event Script Combobox
select database name for result
Happy Everybody MVD!
Screen Shot
Open Code
var
progressbar : Tprogressbar ;
procedure Form1_OnShow (Sender: TObject; Action: string);
Var
Q : TDataSet ;
begin
SQLQuery('Show Databases ',Q);
Form1.Combobox1.Clear;
while not Q.Eof do begin
Form1.Combobox1.Items.Add(Q.Fields.Fields[0].AsString);
Q.Next;
end;
Q.Close;
end;
procedure Form1_ComboBox1_OnChange (Sender: TObject);
begin
Form1.TableGrid1.dbSQL :=
' USE '+Form1.ComboBox1.Text +' ;' + #13#10 +
' SELECT TABLE_NAME, "DDL" FROM information_schema.TABLES ' + #13#10 +
' WHERE TABLE_SCHEMA = "'+Form1.ComboBox1.Text +'" ORDER BY TABLE_NAME ;';
Form1.TableGrid1.dbSQLExecute ;
Form1.Label3.Caption := 'Gen Table List 0 From '+ IntToStr(Form1.TableGrid1.RowCount) ;
Form1.Label4.Caption := 'Progress '+'0.00 %' ;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
i : Integer ;
result : Tdataset;
begin
For i := 0 To Form1.TableGrid1.RowCount -1 Do
Begin
SQLQuery('Show Create Table '+Form1.TableGrid1.Cells[0,i], result);
Form1.TableGrid1.Cells[1,i] := result.Fields[1].AsString;// ddl.Text;
Form1.Label3.Caption := 'Gen Table List '+inttostr(i+1)+' From '+ IntToStr(Form1.TableGrid1.RowCount) ;
Form1.Label4.Caption := 'Progress '+FormatFloat('0.00',(i+1)/(Form1.TableGrid1.RowCount)*100)+' %' ;
progressbar.position := StrToInt(FormatFloat('0',(i+1)/(Form1.TableGrid1.RowCount)*100)) ;
Application.ProcessMessages;
result.Free;
End;
Form1.TableGrid1.BestFitColumns(bfboth);
ShowMessage('OK!');
end;
begin
progressbar := Tprogressbar.Create(Form1) ;
progressbar.Parent := Form1.Panel1 ;
progressbar.Align := AlClient;
progressbar.Min := 0;
progressbar.max := 100;
progressbar.position := 0 ;
end.Thank You Dmitry. It Work ...
Easy Code And View Use
I try create Example MySQL "Show Create Table mysql.xxx"
And generate DDL All Table in database insert column ddl
when copy row and paste in NOTEPAD IT OK Show Full Content
But TableGrid Not display same like NOTEPAD
How To Show ?
Open Code Fix 201810-18
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
i : Integer ;
result : Tdataset;
ddl : Tstringlist;
begin
Form1.TableGrid1.dbSQL :=
' USE mysql ;' + #13#10 +
' SELECT TABLE_NAME,NULL AS DDL FROM information_schema.TABLES ' + #13#10 +
' WHERE TABLE_SCHEMA = ''mysql'' ORDER BY TABLE_NAME ;';
Form1.TableGrid1.dbSQLExecute ;
ddl := Tstringlist.Create ;
For i := 0 To Form1.TableGrid1.RowCount -1 Do
Begin
Begin
SQLQuery('Show Create Table '+Form1.TableGrid1.Cells[0,i] ,result);
ddl.Add(result.Fields[1].AsString);
ddl.Commatext;
Form1.TableGrid1.Cells[1,i] := ddl.Text;
End;
ddl.clear;
result.Free;
End;
Form1.TableGrid1.BestFitColumns(bfboth);
Form1.TableGrid1.BestFitRow(1) ;
end;
begin
end.
Help Me Please !
How To Select "Show DDL All table" : MySQL ???
I Try write It Ok but show null in DDL_TABLE field
SELECT
information_schema.TABLES.TABLE_NAME,
information_schema.TABLES.TABLE_ROWS,
NUll AS DDL_TABLE
FROM
information_schema.TABLES,
WHERE
information_schema.TABLES.TABLE_SCHEMA = (DATABASE());When itry add ddl script "Show Create Table" It Error
SELECT
information_schema.TABLES.TABLE_NAME,
information_schema.TABLES.TABLE_ROWS,
(SHOW CREATE TABLE information_schema.TABLES.TABLE_NAME) AS DDL_TABLE
FROM
information_schema.TABLES,
WHERE
information_schema.TABLES.TABLE_SCHEMA = (DATABASE());Help Me Please !

OK ! Get function TZip ...
This is a bug because 4.7 beta Dropbox has 2 links.
Dimitry Why Error ???

Please attach project or screen shot for help
Or Download Example Report Scipt
Example Report Script
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
IF Copy(<Report."id">,Length(<Report."id">),1) = '1'
Then Memo6.Font.Color := clred
Else If Copy(<Report."id">,Length(<Report."id">),1) = '2'
Then Memo6.Font.Color := clgreen
Else If Copy(<Report."id">,Length(<Report."id">),1) = '3'
Then Memo6.Font.Color := clgray
Else If Copy(<Report."id">,Length(<Report."id">),1) = '4'
Then Memo6.Font.Color := clblue
Else If Copy(<Report."id">,Length(<Report."id">),1) = '5'
Then Memo6.Font.Color := clyellow
Else If Copy(<Report."id">,Length(<Report."id">),1) = '6'
Then Memo6.Font.Color := clmaroon
Else If Copy(<Report."id">,Length(<Report."id">),1) = '7'
Then Memo6.Font.Color := clnavy
Else If Copy(<Report."id">,Length(<Report."id">),1) = '8'
Then Memo6.Font.Color := clolive
Else If Copy(<Report."id">,Length(<Report."id">),1) = '9'
Then Memo6.Font.Color := cllime
Else Memo6.Font.Color := clblack ;
end;
beginHi madbit71
try Example Download
windows 10 has default right click
send to >>> compressed file(ziped) folder
Or
Extract All
i will MVD have this function pure not use third party or External program
Please !
I will little help MVD Community create multiple tdataset in report design by use value string in Tmemo custom syntax
Syntax
<dataset name"xxx">sql</dataset>
Example Image
Example Image With Design & Preview

Open Code
//Fix 2018-09-06 Script Example Report Flag
procedure Form1_Button3_OnClick (Sender: TObject; var Cancel: boolean);
var
frxDBDatasets : array[0..999] OF TfrxDBDataset;
dts : array[0..999] OF Tdataset;
i : integer ;
dtssql : string;
dtsname : String;
begin
Form1.frxReport.Clear;
Form1.frxReport.DataSets.Clear;
For i := 0 To Form1.ComboBox1.Items.Count - 1 Do
begin
//test show message
dtsname := (
Copy(
Form1.ComboBox1.Items[i],
Pos('<dataset name"',Form1.ComboBox1.Items[i])+14,
Pos('">',Form1.ComboBox1.Items[i])-(Pos('<dataset name"',Form1.ComboBox1.Items[i])+14),
)
);
Showmessage(dtsname);
dtssql :=
Copy(
Form1.ComboBox1.Items[i],
(Pos('">',Form1.ComboBox1.Items[i])+2),
Pos('</dataset>',Form1.ComboBox1.Items[i]) - (Pos('">',Form1.ComboBox1.Items[i])+2)
) ;
SQLQuery(dtssql, dts[i]);
frxDBDatasets[i] := TfrxDBDataset.Create(Form1);
frxDBDatasets[i].UserName := dtsname;
frxDBDatasets[i].CloseDataSource := True;
frxDBDatasets[i].OpenDataSource := True;
frxDBDatasets[i].DataSet := dts[i];
Form1.frxReport.DataSets.Add(frxDBDatasets[i]);
end;
For i := 0 To Form1.ComboBox1.Items.Count - 1 Do
frxDBDatasets[i].DataSet.Close ;
Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\test.fr3');
Form1.frxReport.ShowReport;
For i := 0 To Form1.ComboBox1.Items.Count - 1 Do
frxDBDatasets[i].DataSet.Free ;
end;
procedure Form1_Button2_OnClick (Sender: TObject; var Cancel: boolean);
var
st_temp : String;
vt_name : tstringlist;
result_sql : String;
get_x,get_y : Integer;
para_x,para_y : Integer;
paraname : string;
dts : array[0..999] of ttoolbar;
dtsi: integer;
begin
//start
st_temp := Form1.Memo1.Text ;
result_sql := Form1.Memo1.Text;
vt_name := tstringlist.Create ;
vt_name.Clear ;
Form1.ComboBox1.Items.clear ;
Repeat
begin
get_x := Pos('<dataset name"',st_temp);
st_temp := Copy(st_temp,get_x,Length(st_temp));
get_y := Pos('</dataset>',st_temp) ;
paraname := Copy(st_temp,1,get_y+9);
IF Pos(paraname,vt_name.Text) <= 0 Then
vt_name.Add(paraname) ;
Form1.ComboBox1.Items.add(paraname);
st_temp := copy(st_temp,get_y+10,Length(st_temp) );
end;
until Pos('<dataset name"',st_temp) <= 0;
end;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
frxDBDatasets : array[0..999] OF TfrxDBDataset;
dts : array[0..999] OF Tdataset;
i : integer ;
dtssql : string;
dtsname : String;
begin
Form1.frxReport.Clear;
Form1.frxReport.DataSets.Clear;
For i := 0 To Form1.ComboBox1.Items.Count - 1 Do
begin
//test show message
dtsname := (
Copy(
Form1.ComboBox1.Items[i],
Pos('<dataset name"',Form1.ComboBox1.Items[i])+14,
Pos('">',Form1.ComboBox1.Items[i])-(Pos('<dataset name"',Form1.ComboBox1.Items[i])+14),
)
);
Showmessage(dtsname);
dtssql :=
Copy(
Form1.ComboBox1.Items[i],
(Pos('">',Form1.ComboBox1.Items[i])+2),
Pos('</dataset>',Form1.ComboBox1.Items[i]) - (Pos('">',Form1.ComboBox1.Items[i])+2)
) ;
SQLQuery(dtssql, dts[i]);
frxDBDatasets[i] := TfrxDBDataset.Create(Form1);
frxDBDatasets[i].UserName := dtsname;
frxDBDatasets[i].CloseDataSource := True;
frxDBDatasets[i].OpenDataSource := True;
frxDBDatasets[i].DataSet := dts[i];
Form1.frxReport.DataSets.Add(frxDBDatasets[i]);
end;
Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\test.fr3');
Form1.frxReport.DesignReport;
For i := 0 To Form1.ComboBox1.Items.Count - 1 Do
frxDBDatasets[i].free ;
end;
procedure Form1_ComboBox1_OnChange (Sender: TObject);
begin
Form1.Memo2.Text :=
Copy(
Form1.ComboBox1.Text,
Pos('<dataset name"',Form1.ComboBox1.Text)+14,
Pos('">',Form1.ComboBox1.Text)-(Pos('<dataset name"',Form1.ComboBox1.Text)+14),
);
Form1.Memo3.Text :=
Copy(
Form1.ComboBox1.Text,
(Pos('">',Form1.ComboBox1.Text)+2),
Pos('</dataset>',Form1.ComboBox1.Text) - (Pos('">',Form1.ComboBox1.Text)+2)
);
Form1.TableGrid1.ClearRows;
Form1.TableGrid1.dbSQL := Form1.Memo3.Text;
Form1.TableGrid1.dbSQLExecute;
end;
procedure Form1_OnShow (Sender: TObject; Action: string);
var
st_temp : String;
vt_name : tstringlist;
result_sql : String;
get_x,get_y : Integer;
para_x,para_y : Integer;
paraname : string;
dts : array[0..999] of ttoolbar;
dtsi: integer;
begin
Form1.Memo1.Lines.LoadFromfile(ExtractFilePath(Application.exename)+'\sql.txt');
//start
st_temp := Form1.Memo1.Text ;
result_sql := Form1.Memo1.Text;
vt_name := tstringlist.Create ;
vt_name.Clear ;
Repeat
begin
get_x := Pos('<dataset name"',st_temp);
st_temp := Copy(st_temp,get_x,Length(st_temp));
get_y := Pos('</dataset>',st_temp) ;
paraname := Copy(st_temp,1,get_y+9);
IF Pos(paraname,vt_name.Text) <= 0 Then
vt_name.Add(paraname) ;
Form1.ComboBox1.Items.add(paraname);
st_temp := copy(st_temp,get_y+10,Length(st_temp) );
end;
until Pos('<dataset name"',st_temp) <= 0;
end;
begin
end.My Visual Database → Posts by prahousefamily
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi