forked from yzhums/Run-Object-Tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ZYShowTableList.al
192 lines (178 loc) · 5.75 KB
/
ZYShowTableList.al
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
page 83110 "ZY Show Object List"
{
Caption = 'Show Object List';
Editable = false;
PageType = List;
ApplicationArea = All;
PromotedActionCategories = 'New,Process,Report,Filter';
UsageCategory = Administration;
SourceTable = AllObjWithCaption;
SourceTableView = where("Object Type" = filter(= Table | Page | Query | Report | XMLport));
layout
{
area(Content)
{
repeater(TableList)
{
field("Object Type"; Rec."Object Type")
{
ApplicationArea = All;
}
field("Object ID"; Rec."Object ID")
{
ApplicationArea = All;
}
field("Object Name"; Rec."Object Name")
{
ApplicationArea = All;
}
field("Object Caption"; Rec."Object Caption")
{
ApplicationArea = All;
}
field("Object Subtype"; Rec."Object Subtype")
{
ApplicationArea = All;
}
field("App Name"; GetAppName(Rec."App Package ID"))
{
ApplicationArea = All;
}
}
}
}
actions
{
area(Processing)
{
action("Run Selected Object")
{
Caption = 'Run Selected Object';
ApplicationArea = All;
Image = ExecuteBatch;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Process;
Scope = Repeater;
trigger OnAction()
begin
RunObject();
end;
}
action("Show All Tables")
{
Caption = 'Show All Tables';
ApplicationArea = All;
Image = Filter;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
FilterObjects(Rec."Object Type"::Table);
end;
}
action("Show All Pages")
{
Caption = 'Show All Pages';
ApplicationArea = All;
Image = Filter;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
FilterObjects(Rec."Object Type"::Page);
end;
}
action("Show All Reports")
{
Caption = 'Show All Reports';
ApplicationArea = All;
Image = Filter;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
FilterObjects(Rec."Object Type"::Report);
end;
}
action("Show All Queries")
{
Caption = 'Show All Queries';
ApplicationArea = All;
Image = Filter;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
FilterObjects(Rec."Object Type"::Query);
end;
}
action("Show All XMLports")
{
Caption = 'Show All XMLports';
ApplicationArea = All;
Image = Filter;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
FilterObjects(Rec."Object Type"::XMLport);
end;
}
action("Reset Filter")
{
Caption = 'Reset Filter';
ApplicationArea = All;
Image = ResetStatus;
Promoted = true;
PromotedOnly = true;
PromotedCategory = Category4;
trigger OnAction()
begin
ResetFilter();
end;
}
}
}
local procedure GetAppName(var AppPackageID: Guid): Text[250]
var
NavInstalledApp: Record "NAV App Installed App";
begin
NavInstalledApp.Reset();
NavInstalledApp.SetRange("Package ID", AppPackageID);
if NavInstalledApp.FindFirst() then
exit(NavInstalledApp.Name);
end;
local procedure RunObject()
begin
case Rec."Object Type" of
Rec."Object Type"::Table:
Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Table, Rec."Object ID"));
Rec."Object Type"::Query:
Hyperlink(GetUrl(ClientType::Current, CompanyName, ObjectType::Query, Rec."Object ID"));
Rec."Object Type"::Page:
PAGE.RUN(Rec."Object ID");
Rec."Object Type"::Report:
REPORT.RUN(Rec."Object ID");
Rec."Object Type"::XMLport:
XMLPORT.RUN(Rec."Object ID");
end;
end;
local procedure ResetFilter()
begin
Rec.Reset();
Rec.SetFilter("Object Type", '%1|%2|%3|%4|%5', Rec."Object Type"::Table, Rec."Object Type"::Page, Rec."Object Type"::Report, Rec."Object Type"::Query, Rec."Object Type"::XMLport);
Rec.FindFirst();
end;
local procedure FilterObjects(ObjectType: Integer)
begin
Rec.Reset();
Rec.SetRange("Object Type", ObjectType);
Rec.FindFirst();
end;
}