(7 replies, posted in Script)

I am not sure I fully understand what you want but attached is an alternative to the DbFile component.


(3 replies, posted in General)

You really do not need to do an import for a new version of the software. You can do what I do. If a new version of your software requires a change to the structure of your database, you can create a small program which all it does is alter the structure of your end user's database. For example:

SqlExecute('ALTER TABLE company ADD COLUMN coPhone TEXT');

You can also create tables and even populate new tables through this program. Then when it comes time to distribute to your users, you send them the new version of your main program and in addition send them the small database upgrade program. Have your end users run the database upgrade program first. All this program does is change in place their database structure for the new version of your program. No import is necessary. When they run their new version of the program it will be accessing the new version of the database that is already populated.

If you use an install software for your users, you can have this database upgrade program automatically run during the install of your new main program. The user does not even know that it happened.

Optionally there is a PRAGMA instruction to check for the database version prior to the update. So that if the database is not the correct version, then you can take the appropriate steps to either update it or present an error message and not do the update.


(11 replies, posted in Script)

You could also use the IncMonth function which adds months to the date as follows. 120 equates to 10 years.

Form1.DateTimePicker2.DateTime := IncMonth(Form1.DateTimePicker1.DateTime, 120);

I put together the attached example for someone else on the forum in the past. It includes not only new action duplicates, but if the user also tries to change the info which would also cause a duplicate. See if it is workable for you.


(3 replies, posted in FAQ)

Instead of MessageDlg, you could try the attached. It is a timed message with no buttons. Basically it is another form specifically for displaying messages utilizing a timer. Once you have defined the message form and it's associated scripts, all you need to do is place the following line throughout your app to display various messages. You just need to insert your own Title and Message literals in the line of code.

TimedMsg('Your Caption','Your message');

Hope it helps.


(4 replies, posted in General)

It was a little confusing to me. Your code is only retrieving values from one record in the SETTINGS table even though you have multiple records in there. So if you want to have multiple settings then you need to retrieve the corresponding values based on the selected row in your tablegrid. See attached for fix.


(4 replies, posted in General)

In your SETTINGS table you have multiple records. You are checking for colors in record id of 1, but record id of 1 does not exist. I changed the record id 2 to 1 and this corrected it. But since all panel colors did not have values, it was causing an error. I put an IFNULL in your SQL statement to get around this error.


(26 replies, posted in Script)

procedure Edit_function_button (Sender: TObject; Action: string);

Form1.Table.dbsqlexecute('UPDATE Students SET Saff = "'+Form1.Edit1.Text+'",Fasl= "'+Form1.Edit2.Text+'",Name= "'+Form1.Name_txt.Text+'",Nationality= "'+Form1.Edit3.Text+'",Phone= "'+Form1.Phone_txt.Text+'",Gheyab= "'+Form1.Gheyab_txt.Text+'",Takheer= "'+Form1.Takheer_txt.Text+'",Health= "'+Form1.Health_txt.Text+'",Notes1= "'+Form1.Notes1_txt.Text+'",Notes2= "'+Form1.Notes2_txt.Text+'" WHERE id= "'+Form1.Edit4.Text+'" ;');



Form1.Table.dbsqlexecute is not the correct function. This is used to populate a tablegrid. You want to use SqlExecute('...'). However, you are putting in script which MVD will do for you without script.

Since you are relatively new to MVD, may I give you a little advice and it is exactly what I did in the beginning. I studied the examples/tutorials on this website until I understood how MVD works and what it does for you automatically with its Actions and form flow. I built very elementary projects to learn from. It seems like you are trying to go right into scripting without learning the basics of MVD. Believe me, you will have plenty of opportunities to interject scripting as you advance your projects. If I am wrong on this, my apology. But I just want to guide you in the right direction as a newbie.


(26 replies, posted in Script)

You really should create another form to do your ADDs and EDITs. You can't use the fields on Form1 for both searching and updating. Create FORM2 or whatever you want to call it, then place all your fields on there, connect them to the table in the database. Then place a SAVE button on the form and include all the fields in the SAVE action. On FORM1 change the Add and Edit buttons to point to your second form. All this is done without any scripts. You are trying to do way too much on one form. You do not need any of the script to populate the Search fields in Form1 when you click on a tablegrid row. It is misleading to the user.


(26 replies, posted in Script)

You cannot use SqlExecute to populate a tablegrid like you want. If you are not going to use the MVD built-in Search feature, then you either need a button with action of Sql Query, or dbSql script or dbFilter script. Take a look at the project I posted in this thread for a sample of dbFilter script.


(26 replies, posted in Script)

What code error? I am not getting any errors.


(26 replies, posted in Script)

Although I do not agree with your design, I put in script to filter your tablegrid. I wasn't sure if you wanted OR logic or AND logic in your searches so each are independent filters. I did Saff combobox and Name edit field. In my opinion I think you are over scripting in your project, but I do not know what the big picture is for your application.

Why do you fill the search fields when you click on a row in the tablegrid?


(7 replies, posted in General)

Derek, Alan,

Or you could use one line of code to retrieve the record without going through a tablegrid. See attached.


(7 replies, posted in General)

It will just ignore the new fields.


(7 replies, posted in General)

You can connect to your database and manipulate your data without defining it in MVD, but all your database updates will need to de done through script. MVD does a lot of standard data access and manipulation for you. Without the tables and fields defined you will be writing more script that MVD does automatically.

See attached for an example. No database is defined within MVD but access is still possible. Although the database I used is Sqlite, it is the same with Maria/MySql. None of the script would be necessary if the tables and fields were defined inside MVD.

In my opinion, a little bit of effort to define the tables and fields inside MVD will go a long way in developing your project quicker and easier. You only need to do this one time. It would be worth it if it were me. And you only need to define the tables that you want to use in your MVD project.


(45 replies, posted in Script)

Form1.mniFile.visible := false;
Form1.mniClose.visible := false;
Form1.mniOptions.visible := false;
Form1.mniSettings.visible := false;
Form1.mniReport.visible := false;
Form1.mniExportData.visible := false;
Form1.mniImportData.visible := false;
Form1.mniAbout.visible := false;


(7 replies, posted in General)

If you have pre-existing MySql/ Maria DB tables, you need to define the tables and fields in MVD (Database tab). But you only need to define the tables that you plan to access in MVD. One way to do this is to start with defining these tables and fields as Sqlite tables. Then switch the database to MySql and connect to your database. You then can use MVD forms and scripts to access and manipulate your Maria database. Hope this helps. It's probably not what you want to hear, but once you have the tables defined, making changes to the schema can be done through MVD.


(1 replies, posted in General)

You can do this with a searchable combobox. Just turn on the searchable property and as you type into the combobox it will filter your selections.


(1 replies, posted in General)

You can use the FILTER property of the Search field in the Object Inspector.

Typically you do the same thing on subsequent forms. If you could attach your project we could take a look and see what is wrong.


(10 replies, posted in General)

George, Derek,
I found the attached in my example folder. It previews the image before you take the picture (save image).


(10 replies, posted in General)

I am a little concerned about that too. He has not participated on the forum for quite some time. Maybe it has to do with the pandemic or maybe he is working on a major release and does not have time to be on the forum. I don't know and wish he would communicate something on here to relieve some concerns as to the future of this product. I just hope he is alright.


(10 replies, posted in General)

What you are asking for is another story. You are looking for a way to test for a running service, not an open window. I've never had a need for this so I do not have an answer. I would need to so some research on this or maybe Dimitry or someone else could lend a hand here.


(10 replies, posted in General)

See if attached is what you are looking for.


(5 replies, posted in Script)


procedure Form2_OnShow (Sender: TObject; Action: string);
    If Action = 'NewRecord' then Form2.edit1.Text := SqlExecute('Select Max(id) From tablename') + 1;

If the value you are pulling is the primary key(id), It's ok to show this value, but I would be very careful in allowing users to manipulate this value.