Sql: String;
The Sql property determines SQL query of view.
Executing this example requires that the repository contains a database with the BD identifier. A table with a physical name Table_1 is created in this base.
Sub Main;
Var
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
View: IView;
Begin
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_VIEW;
CrInfo.Id := "New_View_1";
CrInfo.Name := "New_View_1";
CrInfo.Parent := MB.Root;
MObj := MB.CreateObject(CrInfo).Edit;
View := MObj As IView;
View.Database := Mb.ItemById("BD").Bind As IDatabase;
View.NativeName := "New_View_1";
View.Sql := "SELECT * FROM Table_1";
MObj.Save;
End Sub Main;
After executing the example, the new view is created in repository root. This view is built on the basis of table Table_1 data.
See also: