Отношение "Многие-ко-многим" строится через кросс-таблицу.
Рекомендую пройти базовый курс обучения: https://vk.com/@createmyvisualdatabasea … nyi-uroven Данная тема рассматривается на третьем занятии ("Реляционные базы данных")
My Visual Database → Posts by k245
Отношение "Многие-ко-многим" строится через кросс-таблицу.
Рекомендую пройти базовый курс обучения: https://vk.com/@createmyvisualdatabasea … nyi-uroven Данная тема рассматривается на третьем занятии ("Реляционные базы данных")
vovka3003, Кому костыль, а кому - решение )))
Раньше не обращал на это внимание, да и клиенты не жаловались, но, признаюсь, решение повышает удобство работы. Возьму к себе в копилочку. Спасибо!
P.S. пожалуй, надо добавить проверку свойства TdbDateTimePicker.Kind, так как данный компонент используется и для ввода времени. В этом случае либо не устанавливать обработчик, либо добавить формат для времени.
Нужно обратиться из скрипта к закладке на PageControl по ее имени.
Т.е. надо что-то такое:
Form_1.PageControl_1.TabSheet_name.Visible := false;
Form1.TabSheet1.Visible := false;
т.е. в скрипте задаётся путь не по Parent, а по Owner, а все компоненты принадлежат форме
Спасибо работает.
Вот только все таки хотелось бы результаты id выполнения процедуры frmAddSch1_Button1_OnAfterClick при создании новой записи ( '+IntToStr(frmAddSch1.Button1.dbGeneralTableId)
получить в переменную, которую в дальнейшем использовать для расчетов.
procedure frmAddSch1_Button1_OnAfterClick (Sender: TObject);
var
tmpNewID:integer; // переменная для хранения добавленного значения
begin
if frmAddSch1.Tag = 1 then // условие выполняется при создании новой записи
begin
tmpNewID := frmAddSch1.Button1.dbGeneralTableId;
SQLExecute ('INSERT INTO res (id_sch) VALUES ( '+IntToStr(tmpNewID));
// далее - ваш код
end;
end;
Возможно, нужное вам решение есть в примерах, описанных в цикле статей о программировании в MVD: https://vk.com/@createmyvisualdatabasea … mmirovanie
L10n. Internationalization
Continuation of the article "L10n. Origin"dedicated to the localization of the application.https://vk.com/@createmyvisualdatabasea … nalization
Dear readers!
I would appreciate your comments. It is very important for me to know your opinion on both the content of the articles and the orientation of the development of the educational project. Please, write in the comments what you think of this article. What more would you like to know about MVD programming? In the next article, I plan to consider an alternative internationalization option for a project in which localized resources are located in a database. Or is there more relevant information on the localization tool for existing projects? Waiting for your answers
Не первая тема на эту тему и, видимо, не последняя ))) Выходит, что правильней всего не хранить пароль подключения к базе в самой программе. Но тогда встаёт вопрос создания и управления пользователями на сервере MySQL силами приложения, созданного в MVD, правами доступа и всё такое )))
LL10n. Origin
If you want to create universal applications, sooner or later, you will think about its location. Since My Visual Database does not have built-in tools for this purpose, you will need to develop your own system to get the desired result.
The system must be simple and not need to modify the applications for its implementation. One of the key requirements is also the ability to change languages at any time.
Thus, in addition to the language resource preparation tool, we need a script that will load these resources.
Read the full article: https://vk.com/@createmyvisualdatabasea … 10n-origin
У меня есть пример создания меню из данных, хранимых в БД. Пример довольно сложный, описание здесь: https://vk.com/@createmyvisualdatabaseapp-menu в конце описания - ссылка для скачивания проекта.
Собственно, построение меню идёт в процедуре LoadMenu(). Меню создаётся на форме frmMain.
procedure LoadMenu;
var
tmpMainMenu: TMainMenu;
tmpDataSet:TDataSet;
tmpSQL:string;
tmpMenuItem: TMenuItem;
tmpParentStack: array[1..MAX_MENU_LEVEL+1] of TMenuItem; // стек для хранения родительских элементов при создании главного меню
tmpLevel: integer;
begin
tmpMainMenu := TMainMenu.Create(frmMain);
frmMain.Menu := tmpMainMenu;
// запрос формируется с учётом прав пользователя
tmpSQL :=
' select menu_.* , object_.name as object_name '+
' from menu_'+
' left join object_ on object_.id = menu_.id_object_';
// если роль указана, то добавляем фильтр по роли:
if RoleID <> 0 then
tmpSQL := tmpSQL +
' left join role_object_ on role_object_.id_object_ = object_.id'+
' where (menu_.id_object_ is null) or (role_object_.id_role_ = '+inttostr(RoleID)+' )';
// сортировка обеспечивает правильность сборки дерева
tmpSQL := tmpSQL + ' order by order_num';
//
SQLQuery(tmpSQL,tmpDataSet);
while not tmpDataSet.EOF do
begin
tmpMenuItem := TMenuItem.Create (tmpMainMenu);
tmpMenuItem.Caption := tmpDataSet.FieldByName('name').asString;
tmpMenuItem.Tag := tmpDataSet.FieldByName('id').asInteger;
// если указан объект, то подключаем обработчик
if not tmpDataSet.FieldByName('id_object_').isNull then
tmpMenuItem.OnClick := @MainMenuClick;
tmpLevel := tmpDataSet.FieldByName('level').asInteger;
//
if tmpLevel = 0 then
begin
tmpMainMenu.Items.Add(tmpMenuItem);
end
else
begin
tmpParentStack[tmpLevel].Add(tmpMenuItem);
end;
// записываем в стек текущий элемент как родителя для следующего уровня
tmpParentStack[tmpLevel+1] := tmpMenuItem;
// переходим к следующей записи
tmpDataSet.Next;
end;
tmpDataSet.Free;
end;
Изящно! Всего лишь поменяли дескриптор у объекта-структуры Так и продублировать меню на другие формы можно!
Продублировать таким макаром нельзя, так как один экземпляр главного меню (TMainMenu) может быть только у одной формы. Но можно поэлементно скопировать.
Hello ,
1) I had a look on the entire forum and found the program 13 anatomy. Looks awesome and i would like to copy several thing into my own app but i`m unable to do so because i don`t speak Russian therefore i don`t understand the text and the script explanations and i`m unable to learn how the program works. If someone is kind enough to translate it in English would be awesome.
...
Articles are available in English: https://vk.com/@createmyvisualdatabaseapp_en
Anatomy https://vk.com/@createmyvisualdatabasea … omy-lesson
Forum branch "Training courses for developers. Articles about application developmen" - http://myvisualdatabase.com/forum/viewtopic.php?id=5286
I asked a question for any workaround of MVD treeview recently on thread below but nothing from you so far:
http://myvisualdatabase.com/forum/viewtopic.php?id=5333
You got two options for solving your problem, including an example in the working code. To sort the tree, you must have a field in which the sequence number is stored, as well as the code that will update this field. This is how SQL works. The TreeView component has everything you need to implement sorting.
if you use SQLite and SQLQuery() you must free used DataSet.
SQLQuery('select a from b', tmpDataSet); // database is locked
...
tmpDataSet.Free // database is unlocked
Добавляйте столько строк, сколько вам нужно, прямо в цикле:
for i := 0 to JsonArray.Size-1 do
begin
JSONObjProp := TJSONObject( TJSONObject(JsonArray.Get(i)));
JSONString := TJSONString(JSONObjProp.GetPairByName('password').JsonValue);
frmAdmin.tgUserApp.AddRow;
frmAdmin.tgUserApp.Cells[0,frmAdmin.tgUserApp.LastAddedRow] := JSONString.Value;
end;
У меня таблицы связаны так: 1<-2<-3->4->5, где стрелочки - это ключи-связи.
Видимо, вы добыли ценную информацию о том, какая таблица должна быть главной в связке: та, на которую нет ссылок других таблиц.
Если бы пришлось писать запрос вручную, то по вашей схеме выборку нужно делать из таблицы 3, а остальные таблицы - джойнить, так что всё выглядит логично )))
Главную таблицу рекомендуется указывать, если число таблиц, данные из которых связываются построителем, больше двух.
... можно ли перенести главное меню на другую форму? ...
var
Menu:TMainMenu;
begin
Menu := Form1.Menu;
Form1.Menu := nil;
Form2.Menu := Menu;
end.
Код переносит главное меню с Form1 на Form2
Зачем..? Так не проще?:
Если авторизация не проходит, то некрасиво блымкает главная форма перед своим закрытием.
An accordion tune
One of the popular elements of the user interface is the "accordion" menu, which takes its name from its similarity to the famous musical instrument. Of course, the full animation of our accordion will not work, but you can add style and convenience to the app.
We will start from the TableGrid component and with the help of the parameters of its properties and additional scripts, we will play the melody we need.
Read the full article:https://vk.com/@createmyvisualdatabasea … rdion-tune
Anatomy lesson
In the previous article, we used a list of application forms and a list of form components to get a list of forms and buttons. We will continue our study by examining the structure of the components: we will build a tree representation of the visual components available in the project - the heirs of the TControl class.
In addition, this article will discuss the construction of the software tree, as well as the FilterTree() procedure, which filters the data, while maintaining the structure of the tree itself.
Read the full article: https://vk.com/@createmyvisualdatabasea … omy-lesson
An advantageous agreement
As you have noticed, the names of all project elements are significant and follow certain rules. We can now receive dividends from these agreements:
• minimum software code
• maximum code reuse
• automation of user interface feature settings
We will also take a look inside our application so that the setting of access rights becomes global: from now on, any button can be added to the rights system. A mechanism will also be created to work with the modal version of the reference book to be used when editing forms.
Read the full article: https://vk.com/@createmyvisualdatabasea … -agreement
The basic course is an easy and quick way to get acquainted with the My Visual Database application development system. Training materials contain the necessary minimum of information and are well structured, and practical exercises will allow you to create your first database application.
Until July 1, 2019, you can complete the first lesson for FREE: https://vk.com/createmyvisualdatabaseap … 1997157_18
Property CopyTo does not work when you use MySQL
CopyTo property allows you to specify where you want to automatically copy the file path relative to the location of the database file.
When you use MySQL, MVD can't to know where MySQL database files are placed, MVD know only IP address.
Can in CopyTo property write the full path?
d:\Photos\
or
\\Tetacomputer\DCIM\
All forms created in the MVD IDE are automatically created when the application starts and are destroyed only when application is closed. You can create forms and place the necessary components on them with the scripts, destroying forms immediately after they are closed. This will reduce the use of memory, but will significantly complicate the development of the application
As far as I could understand, your project script is for delphi, I was looking answers for MVD.
I wrote a series of articles on creating applications in MVD. You may be interested to read the articles in chronological order: https://vk.com/@createmyvisualdatabasea … rogramming
Article and scripts exclusively for MVD )))
To change the branch in which the element is located, use the "Parent" drop-down list (3). To move an element within a branch, use the "Down" (1) and "Up" (2) buttons.
This article describes the scripts for editing the tree, in particular the procedure MoveTreeItem (ATable: string; ATree: TdbTreeView; AOrderNumCol: integer; ADown: boolean) ;.
The structure of the table with the tree is described here: https://vk.com/@createmyvisualdatabaseapp_en-menu
Direct link to the MVD project download:https://drive.google.com/file/d/1dRWfgy … Rzrvm/view
My Visual Database → Posts by k245
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi