1

(13 replies, posted in General)

+1

sparrow wrote:
darko.bublic wrote:

... Can MVD use the flatbed scanner directly from the program?
Thank you for your reply.


Com port has nothing to do with this.
Directly from the program you can.
But this is not for a beginner and will require you to have sufficient knowledge to write appropriate scripts.
If you are ready to search, read and learn, then you will succeed.

Just realized it by reading the article. Anyway, just thinking maybe darko.bublic wants to create the pdf by directly reading the images from the scanner? Which basically needs a complicated process. I'm no expert in this field. That flatbed I think do have some software and drivers that handle in creating pdfs I think it is easier to have these software and driver to handle these tedious works then just upload it in database via MVD.

Also you might want to check derek's latest post about TWebBrowser Container. It might help with your design.

https://myvisualdatabase.com/forum/view … hp?id=8872

I'm not an expert but here's a sample, worth a try. Unfortunately, I don't have with me a flatbed scanner or other devices to test.

I haven't tried it yet, let's hope someone does. But there is so called TComPort Class embedded in MVD. I believe it is something to do with want you want to attain (communicating with hardware connected to the PC I guess). Not have much of a time to research but try here.

https://blogs.embarcadero.com/powerful- … n-windows/

Not all in that post can be used as to MVD Pascal Script do have limitations such as creating Type, etc

darko.bublic wrote:

Hello everyone
Is it possible to create an application in MVDB for processing PDF documents in such a way as to create a preview window for the selected record?
Thank you in advance

Is there any reason you want to program a window for previewing? For me it is much easier to let your user's PC to handle the viewing of PDF. If no installed PDF viewer, browsers nowadays can pretty handle previewing PDFs. This is if you are accessing a record, a PDF file.

But if you want to create a PDF in MVD using record from your database, then MVD can handle this easily.

7

(8 replies, posted in Database applications)

SorbMax wrote:

What scripting language do you recommend for someone new to Pascal when working with MVD, and how crucial is it to understand Delphi syntax for MVD scripting?

Some of Delphi syntax like Types will not work in MVD, It is a plus to know Delphi tho but it is not necessarily needed I guess. Familiarize with Pascal Script, then jive to Delphi. You can discover some properties that is not included in MVD  but might work as a script. e.g. the OnActivate property of Forms. This is not present in MVD but is available behind the scene. I discovered this when working on Delphi projects.

8

(3 replies, posted in General)

Oh, is there any problem with what you are doing? Copying sqlite.db to backup.db? It will always replace backup.db I think. Can you cite some example of what you really want to do so that it is easier to understand like citing filenames, what "one name" are you referring to, etc.

9

(3 replies, posted in General)

Try replacing the backup.db with the date and time format

procedure form2_Button8_OnClick (Sender: TObject; var Cancel: boolean);
begin
  if CopyFile('sqlite.db', 'Backup\'+FormatDateTime('mm_dd_yyyy_hh_nn_ss', now)+'.db') then showmessage('backup ok');
end;

10

(5 replies, posted in Script)

Eccalef wrote:

Подвиньтесь, звезды Мишлен, ктоми устроил пир по сценарию! Menu.zip может похвастаться 335,73 КБ чистого кода, причем 378 участников форума уже взяли по байту. Но подождите, 2medhat_zaki добавляет еще одну особенность — «как переместить проект форм в другой проект». Внезапно vovka3003 задается вопросом: «А в чем 'динамичность'..?» Брайан.забалла добавляет остроты, превращая динамическое меню в функцию. Кухня кодирования полна вкусов!

I can't understand Russian, having it translate on google translate seems you're liking the post.
Here's another version of it. A cleaner for me. I think having all the procedure under one procedure is one way to simplify things I guess in pascal.

Keep in mind that the menu procedures will only be accessible inside the MENUINIT procedure in this example.

11

(14 replies, posted in General)

sparrow wrote:

Brian, Sorry, I didn't look at the sender)))


I'm using a Required parameter but defining the value for the field directly on the form. The value 0 is not informative for me.

p.s. By the way, MARIADB 10.10.3 does not allow you to create from 0.

What you mean by create from 0? Set default value as zero?
If that's the case then most likely MariaDB Ver10.11.2 tcoton's using also not allowing zero as default value then. Sorry for I'm not so familiar with MariaDB since I'm working with MySQL Community edition ever since and don't have time to test on it as of the moment.
Anyway @tcoton, I think setting it as 0000-00-00 instead is not that tedious. You'll only set this once.

12

(14 replies, posted in General)

sparrow wrote:

You are trying to show me that MYSQL does not support 0 or 'now' in date and time. This is known.
But this is not a drawback of MYSQL, but a feature of SQLITE.
For SQLITE, there is no strict correspondence between a given column type and its contents in a cell,
and this is described in the SQLite documents.
As for the default date value, you can assign it in the form in which you define this value.
For example, by writing it in a script.

Zero (0) was my solution and working for me, check on my video. I'm aware of the capabilities of sqlite and mysql. I'm addressing that video to tcoton.

13

(14 replies, posted in General)

tcoton wrote:

@Sparrow

Yes it does but then, if you set a date column not null, you must set a default value and the default value 'now' that works in SQLite does is not accepted by MysQL/MariaDB, there is an error and the table cannot be created,  hence my answer with the correct format above your comment.

Another hiccup when connecting to a fresh database with no tables in MySQL/MariaDB from a MVD project, it tries to create twice the table "_user", throws a duplicate error and creates a useless table "_mvd_roles". This never happens when connecting to an empty database from a compiled project. I tried it multiples times when testing my Delete - Import routine. You can also, as I mentioned before, connect the application to an already filled up database containing the exact structure required with no problem at all.

The subject of this post was really about the default value of a Date column when not null is forced in MySQL.

You mention again here the default value being 'now', changing it to zero fixes the problem for me. If possible, maybe you can send here the tables.ini you are working with so that we can test on it.

14

(14 replies, posted in General)

Well, here's mine, no problem at all.
https://1drv.ms/v/s!AlhiHP7f0ZGDh6Qba-O … w?e=SoEhmh

15

(14 replies, posted in General)

tcoton wrote:

Yes, I tried zero and I get the same error saying that it is a wrong default value for a date. However, removing the non null constraint, then modifying the table with the right parameters within MySQL does the trick. It does work also to create the table directly in MySQL before connecting the app, it is just more cumbersome.

Maybe something about mysql version. I'm using 5.6.51.

16

(1 replies, posted in General)

tcoton wrote:

Hi all,

I have a curiosity question: When calling a form containing one or many grids with auto queries from a button "show form", the grids are automatically refreshed and display any data requested, why is it not the case when calling the very same form from a script that contains either ShowModal or Show, the form appears but the grids are empty unless we write the scripts with tablegrid.dbupdate?

use ShowRecord instead.

var recid: Integer;
recid := 1; // let's say you want to show record with ID: 1
Form1.ShowRecord('tablename', recid);

17

(27 replies, posted in General)

tcoton wrote:
sparrow wrote:

Derek described everything.

It is advisable to simply replace the space character with an unused character. Then there will be no false positives.
Example:

trim(ifnull(info1||'§','')||ifnull(info2||'§','')) 

Hi all,

Any idea on how to translate this Sqlite version to MySQL? I get a ton of errors while trying to tweak it to fit MySQL and I am not far from the headache.

try

trim(concat(ifnull(CONCAT(info1,'§'),''),ifnull(CONCAT(info2,'§'),''))) 

18

(6 replies, posted in General)

jayvallejera wrote:

Good day everyone!

I'd like to ask if MVD has a logging feature that records all the transactions in the system. Like who or which user that made the changes in the database from login to CRUD transactions. Thank you.

I think there is none, you need to create your own logic for this.

19

(14 replies, posted in General)

tcoton wrote:

Hi all,

I am trying to migrate an application that always was working with Sqlite which contains 2 Date columns that should not be null. While it was working fine with Sqlite which stores dates as text, the creation of these columns is problematic when connecting to a blank MySql database when Myvisualdatabase tries to create the tables. It trows the infamous "Invalid default value for 'Date_Column'.

I have tried to change the default value with "CURRENT_DATE" or "CURRENT_TIMESTAMP" in MyVisualDatabase with no luck, I still get the same error when creating the tables in MySQL. Any experience on anyone side?

Have you tried setting the default value to zero (0)? basically datetime in mysql is just a float

20

(8 replies, posted in General)

Good day everyone. bumped to this post when I'm looking for something.
Reopening the application helps me a lot, especially when restoring sqlite database from backup, You can replace the database by simply closing the main form then reopen the application. I just run into some problem with specifying the exe name in OpenFile. Well, my mistake by simply reusing code or renaming the application, then not changing this line of code. To address this, maybe someone will encounter that problem, you can change it by Application.ExeName. this will get the absolute path of the executable and you can reuse the code without worrying,

// close the form
Form0.Close

// Replace database here

// Reopen file
// openfile('roles.exe'); 
OpenFile(Application.ExeName);

21

(9 replies, posted in Database applications)

tcoton wrote:
brian.zaballa wrote:

Here's an updated link of the project.

https://www.dropbox.com/s/1dnv5mcv3sqgp … r.zip?dl=1

It would be useful if we could see what the icon is going to look like depending on the theme chosen and if we could actually add more themes. smile

this is interesting, best way to do this is to add an image field on database tho that image will be a different file from the DLL., or maybe someone here knows how to extract the icon/image from that DLL?

If the source I've read is correct that the Resource Hacker was made using Delphi, If I got some spare time, then I would love to dig on this one and create a tool that can extract that icon.

You can add DLLs you modified using Resource Hacker on the folder as stated in the procedure.

22

(3 replies, posted in General)

you can try setting InputPass as empty string.
as to saving the password, there's a couple of way to do it in my perspective.
you can save it in database. or in an ini file. but make sure to encrypt it.

23

(5 replies, posted in Script)

I made this dynamic menu as a function.

24

(3 replies, posted in General)

You can play with script. I'm just wondering to what scenario in real world will it be used.

25

(4 replies, posted in General)

Destiny wrote:

Hello, I know how to avoid duplicates in a table but how to modify an existing record and replace it.

this is vague. are you perhaps looking for script? sql query?
if sql query, then you can use UPDATE or INSERT OR REPLACE query.

Something like...

INSERT OR REPLACE INTO `yourtable`(id, yourfield) VALUES (1, 'test2');

or

UPDATE `yourtable` SET `yourfield`='test2' WHERE id=1;