1

(8 replies, posted in General)

sparrow wrote:

Procedures and functions, referred to collectively as routines, are self-contained statement blocks that can be called from different locations in a program. A function is a routine that returns a value when it executes. A procedure is a routine that does not return a value.

Let's change the code a little so that there is no cognitive dissonance. )) The function will return true if the field is added, and false if the field already exists.

Function Add_newfield(tabela,novo_campo,tipo,e_default,dado: string):boolean;
var
  ColResults: TDataset;
begin
  Result := True;
  SqlQuery('pragma table_info(['+tabela+']) ',ColResults);
  while not ColResults.Eof do
  begin
    if UpperCase( ColResults.FieldByName('name').asString ) = UpperCase( novo_campo ) then
    begin
      Result := False;
      Break;
    end;
    ColResults.Next;
  End;
  ColResults.Free;
  If Result then
  Begin
     SqlExecute('ALTER Table ['+tabela+'] ADD COLUMN ['+novo_campo+'] '+tipo+' '+E_DEFAULT+' '+dado+' ');
     if length(trim(dado)) > 0 then
         sqlexecute('UPDATE ['+tabela+'] SET  ['+novo_campo+'] ='+dado+' ');
  End;
end;

1. Чтобы сделать решение независимым от СУБД, придется использовать решение, которое все же будет "напрягать" программу, в некотором смысле.  Добавление поля on_line - самое простое решение, но у него есть недостаток: в случае аварийного завершения программы пользователь так и останется отмеченным он-лайн. Если требуется более достоверная информация, то это поле нужно сделать типа DateTime, а приложение должно обновлять его каждую минуту (по таймеру). В этом случае можно определять подключенных пользователей с точностью в одну минуту. Но есть тут подводный камень: для MySQL все будет точно, так как время в базу будет записываться серверное, а вот в SQLite каждый компьютер будет записывать своё локальное время.


2. Контроль числа запущенных экземпляров правильно бы сделать на мьютексах, но их в MVDB нет, остается вариант с поиском запущенной копии по заголовку окна.

// Не мьютекс, но работает почти всегда)))
// Проверка заголовка главной формы

const
  APP_NAME = 'My App Name';

procedure Form1_OnShow(Sender: string; Action: string);
begin
  Form1.Caption := '';
  if FindWindow(nil, APP_NAME) <> 0 then
  begin
    ShowMessage('Application is already launched.');
    Form1.Close;
  end;
  Form1.Caption := APP_NAME;
end;

Этот пример и другие решения можно найти в "Руководство разработчика" - это база знаний, куда вы сможете добавлять свои собственные находки.
https://k245.ru/software-ru/is-ru/rukov … chika.html

3

(3 replies, posted in Talks about all)

Use StrToMD5() function:

procedure Form1_Button7_OnClick (Sender: string; var Cancel: boolean);
begin

If  StrToMD5(InputBox('To continue, enter Admin Password!', 'Enter Password:', ''))='8765BF543ААА8765А45300CCA' then

    begin
      Form1.Button6.click;
    end else
    begin
      MessageDlg('Incorrect Password', mtError, mbOk, 0);
    end;
end;

Calculate the hash value in advance.  And don't forget to delete the scpript.pas file from the end user's copy of the program.


Some info about Authentication

https://k245.ru/wp-content/uploads/2022/09/autentifikatsiya.jpg
https://k245.ru/en/mvdb-en/authentication.html

4

(8 replies, posted in General)

Very cool!

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10573&amp;download=0

5

(7 replies, posted in General)

Tree filtering works differently.

1) Filtering at the database level
In order for the data to be displayed, the tree structure must be preserved, that is, the data remaining after filtering must have valid links to parents and at least one root element.

2) Filtering at the client level
In a loop, iterate through the elements of the tree and set their visibility property. This method is simpler, but only works with a small data set.

https://k245.ru/wp-content/uploads/2023/09/img-2023-09-16-16-08-38.jpg

https://k245.ru/mvdb/otobrazhenie-drevo … atsii.html
https://k245.ru/mvdb/otobrazhenie-tabli … annyh.html

6

(3 replies, posted in FAQ)

Yes, at the end of the articles there are links to projects, you can download them and use the code in your projects:


ClassExplorer 1.8: (dynamic tabular forms)
https://drive.google.com/file/d/15pTJZW … drive_link


DataKeeper 1.9 (dynamic edit form)
https://drive.google.com/file/d/1iowR22 … drive_link

7

(3 replies, posted in FAQ)

I have no options on how to deal with the tables. But there is a solution regarding forms. I noticed that most of them have similar functionality and came up with a system in which similar forms are created when the program starts using a text file describing the forms.
https://k245.ru/en/mvdb-en/test-tube-forms.html


And in another project I use an edit form generator.
https://k245.ru/en/mvdb-en/dynamic-interface.html

8

(5 replies, posted in General)

I think it's possible. You will need a picture with transparency showing the indicator scale. The arrow can be drawn directly on the picture canvas. I’m not sure about the smoothness of the animation, but it can be improved by double buffering the form and setting a timer according to which the arrow drawing will be updated.

9

(3 replies, posted in General)

If you need to combine data from different sources (databases), you may need global identifiers.

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

Адаптивная верстка
https://k245.ru/wp-content/uploads/2024/05/vdvptivnaya-verstka2.jpg
Моделирование адаптивной верстки формы редактирования в среде разработки My Visual Database.
https://k245.ru/mvdb/adaptivnaya-verstka.html

11

(24 replies, posted in General)

If I understand you correctly, then you are interested in the dependence of the structure of treatment on the drugs used and their combinations for patients with the same diagnosis. You should look for other ways to get the analytical information you need. For example, building various queries using SQL and aggregate functions.More information is needed to make any specific recommendations.

12

(24 replies, posted in General)

The development environment does not support cross-tabs (what you need, judging by the picture), but you can achieve the desired display using a script. However, its implementation will take time and effort, and performance for 1000 patients will leave much to be desired. For this reason, the master/detail view is used in such cases. But if the waiting time for generating such a report is not critical, then you can try to implement it. The plan is this: using the SQLQuery procedure, obtain the initial data set, and then fill the cross-table row by row in a loop; first, using a separate query, you need to get a list of medications and add the corresponding number of columns.

Добрый день, Александр!
Поздравляю с успешным стартом вашего проекта!
Мне очень приятно, что я смог оказать вам помощь в реализации вашей программы.
От имени всех участников форума и от себя лично желаю вам и вашему проекту успеха и дальнейшего развития!

14

(20 replies, posted in General)

sparrow wrote:
StateOne wrote:

Help required....


Check out this example

https://myvisualdatabase.com/forum/view … 530#p32530

Thank you, sparrow!

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10461&amp;download=0

StateOne, this will work if you specify the password for the application as the password. You need to create it in your Google account security settings. But first you need to enable two-factor authentication.

https://myaccount.google.com/apppasswords

15

(20 replies, posted in General)

https://k245.ru/wp-content/uploads/2022/12/tupik.jpg

16

(20 replies, posted in General)

I think it's all about the gmail security settings. I couldn't persuade him big_smile Is it possible to use another mail server to send emails?

kavinacomputers wrote:

How do you compile? and check results
Any compiler you link to notepad++

The compilation is produced by My Visual Database. But there is one caveat: it only shows the line with the error in its built-in editor. Therefore, usually creating and debugging modules occurs like this: first, all procedures and functions are written in the built-in editor, and after they are fully tested, they are transferred to external files (modules). But over time, you can write the source text directly in NotePad++, which has convenient syntax highlighting and global search.

kavinacomputers wrote:

@k245

Do you have English version of your projects?

I have a module for localizing applications, I use it when I need to create applications in several languages. The ClassExplorer application is an example of using this module.

https://k245.ru/wp-content/uploads/2023/04/vybor-yazyka.png

https://k245.ru/en/mvdb-en/resources-an … ation.html

kavinacomputers wrote:

I am missing something but how you are getting those class files? example utils.pas, form.pas

Exploring your site very cool stuff bookmarked.

I create them using a text editor Notepad++

https://k245.ru/wp-content/uploads/2022/07/izobrazhenie_2022-07-25_122619968-1024x806.png

and their content is the experience of developing applications in MVDB since 2018. More modules can be found in the ClearApp project

https://k245.ru/en/software-en/clearapp-2.html

If you use SQL then nothing is automatically attached  in MVD.
But if you write a query for a calculated field, then it is executed in the context of the main table query.

1) use unit command; ( see https://k245.ru/en/mvdb-en/butterfly-effect.html  https://k245.ru/en/mvdb-en/correction-of-mistakes.html )
2) use DynamicWrapperX  https://myvisualdatabase.com/forum/view … 518#p37518
3) use CreateOleObject  https://myvisualdatabase.com/forum/view … 547#p48547
4) use TFileStream class https://myvisualdatabase.com/forum/sear … 1320082609


P.S. first aid: https://myvisualdatabase.com/forum/search.php

22

(4 replies, posted in Russian)

Думаю, что не успел.

23

(4 replies, posted in Russian)

Пока только ошибка:

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10445&amp;download=0

Ранее я писал о классе TTabControl , который имеется в MVDB, но практически бесполезен.

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


Недавно обнаружил ещё одного признака - TTrackBar.


Его можно призвать к жизни несложным заклинанием, но вот использовать его не получится - отсутствует возможность добавить обработчик  onChange на сдвиг ползунка.

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=10444&amp;download=0

Структура и отображение
https://k245.ru/wp-content/uploads/2024/05/struktura-i-proektsii.jpg
Data Keeper. Создание независимых параметров (видимость, порядок следования и др.) для унаследованных свойств класса.
или
Как с помощью одной формы редактировать несколько таблиц.
https://k245.ru/mvdb/struktura-i-otobrazhenie.html