· 8 years ago · Dec 07, 2017, 06:50 PM
1/****************************************************************
2 tbTaskVW.sql
3
4 A collection of procedures related to View. Please follow this cnonvestional here.
5
6 2 functions as mandatory for view :-
7 - Prepare data for VIEW. Function name must be formated "Schema".tablenameVWM_UserData( ... )
8 - Update data fro VIEW. Function name must
9
10 Wutirkai Pornchai
11 28-04-2014
12
13 select * from "dbSys".tvCreateView ( varint('userid'), varint('accid'), '"dbPM".tbTask', dropit:=true);
14
15*****************************************************************/
16
17
18
19/******************************************
20View Procedures
21*******************************************/
22 -- * Data selected for underlying user
23drop function if exists "dbPM".tbTaskVW_UserData ( in UserID int , in AccID int
24 ,in _id int
25 ,in _idgrp int
26) cascade;
27create or replace FUNCTION "dbPM".tbTaskVW_UserData ( in UserID int , in AccID int
28 ,in _id int = null
29 ,in _idgrp int = null
30)
31returns table (
32 id int
33 --* Project mandatory
34 ,title text
35 --,Duration int
36 ,Duration interval
37
38 ,StartDate timestamp_wtz
39 ,FinishDate timestamp_wtz
40 ,Complete numeric -- "dbSys".Percent -- num
41
42 ,ActualStart timestamp_wtz
43 ,ActualFinish timestamp_wtz
44 ,ActualComplete numeric -- "dbSys".Percent --num
45 ,PredecessorID int
46 ,Resources text
47 ,Tags text
48 ,ManDay text
49 ,Remark text
50 --*
51 ,DBSchema text
52 ,DBTable text
53 ,DBFunction text
54 --*
55 ,Project text
56 ,UID int
57 ,ACC int
58 ,PID int
59 ,IDGrp int
60 ,grp text
61 ,planCalTaskID int
62 ,ActualCalTaskID int
63 ,dis smallint
64 ,orderno smallint
65 ,fqty smallint
66 ,idprev int
67 ,seq int
68 ,path int[]
69 --* ancestor ----------------------------------
70 ,CalenNameID int
71 ,CalenName text
72 ,tasktypeid int
73 , tasktypeName text
74 ,venue text
75 ,description text
76 ,WholeDay boolean
77 ,part_ids int[] -- array of contact id
78 ,part_names text
79 , SenderID int
80 , receiverID int
81 , ResponsibleID int
82 ----------------------------
83 ,keyword text
84 ,docid int
85 ,docname text
86 ,count_imagefile smallint
87) AS $$
88declare sql text; foundACC int;
89 idd int = _id; -- redirect avoid collision
90begin
91
92 return query
93
94 select
95 a.id
96
97 --* Project mandatorya
98 --,a.title
99 ,case when a.title is null then a01.title else a.title end Title
100
101 ,a01.duration -- a01.Duration
102
103 ,a01.StartDate -- a01.StartDate::date StartDate
104 ,a01.FinishDate -- a01.FinishDate::date FinishDate
105
106 --,a0306.tvalue ::numeric complete -- ,a01.complete Complete
107 ,a.complete
108
109 ,a02.StartDate ActualStart
110 ,a02.FinishDate ActualFinish
111
112 ,a02.complete ActualComplete
113 ,a.PredecessorID
114
115 --,"dbPM".tbTask_ResourceNames( a.id ) Resources
116 ,t2.results Resources
117 --,"dbPM".tbTask_TagNames( a.id, '"dbPM".tbTKTag', '"dbPM".tbpjtag' ) Tags
118 ,t1.results Tags
119
120 ,a0304.tvalue ManDay
121 ,a0305.tvalue Remark
122 --*
123 ,a0301.tvalue DBSchema
124 ,a0302.tvalue DBTable
125 ,a0303.tvalue DBFunction
126 --*
127 ,a00.title Project
128 ,a.uid -- a00.uid
129 ,a.acc -- a00.acc
130 ,a.pid -- Project ID
131 ,a.idgrp
132 ,a1.title grp -- ,a1.title grp
133 ,a.planCalTaskID
134 ,a.ActualCalTaskID
135 ,a.dis
136 ,a.orderno
137 ,a.fqty
138 ,a.idprev
139 ,a.seq
140 ,z.path
141 --* ancestor ----------------------
142 --,a00.id CalenNameID -- a.CalenNameID
143 ,a01.CalenNameID -- a.CalenNameID
144 ,a00.title CalenName
145 , a01.taskType tasktypeID
146 ,a2.tasktype tasktypeName
147 , a01.venue
148 , a01.description
149 , a01.WholeDay
150 ,a01.part_ids
151 ,"dbCalen".tbcaltask_part_names( a01.part_ids) part_names
152 ,aa.contactid -- a.Sender -- its id
153 ,ab.contactid --a.Receiver -- its id
154 ,ac.contactid -- a.Responsible -- its id
155 ------------------------
156 ,a3.keyword --,"dbPM".tbtask_fulltext_search(a.id)
157 ,a.docid
158 ,a6.title docname
159 ,a.count_imagefile
160 from
161 "dbPM".tbtask a
162 right join "dbSys".grpGetData( UserID, AccID, '"dbPM".tbtask', path_only:=true ) z on ( z.id=a.id )
163
164 left join "dbPM".tbProject a00 on (a00.id = a.pid )
165 left join "dbCalen".tbCalTask a01 on (a01.id = a.PlanCalTaskID)
166 left join "dbCalen".tbCalTask a02 on (a02.id = a.ActualCalTaskID )
167 --left join "dbPM".tbTask a02 on (a02.id = a.ActualCalTaskID )
168
169 left join "dbPM".tbTkField a0301 on (a0301.pid = a.id and a0301.Title = 'DB Schema' )
170 left join "dbPM".tbTkField a0302 on (a0302.pid = a.id and a0302.Title = 'DB Table' )
171 left join "dbPM".tbTkField a0303 on (a0303.pid = a.id and a0303.Title = 'DB Function' )
172 left join "dbPM".tbTkField a0304 on (a0304.pid = a.id and a0304.Title = 'Man-Day' )
173 left join "dbPM".tbTkField a0305 on (a0305.pid = a.id and a0305.Title = 'Remark' )
174 left join "dbPM".tbTkField a0306 on (a0306.pid = a.id and a0306.Title = 'Complete' )
175
176 left join "dbPM".tbtask a1 on a1.id = a.idgrp
177 --left join "dbCalen".tbcaltask a11 on a11.id = a1.plancaltaskid
178 --left join "dbCalen".tbcaltask a11 on a11.id = a1.plancaltaskid
179 left join "dbBase".tbtasktype a2 on (a2.id = a01.tasktype )
180 left join "dbPM".tbProject_Task_fulltext_search( a.id ) a3 on a3._id= a.id
181
182 left join "dbCalen".tbcalpart aa on aa.pid = a.id and aa.calroles='Sender' and aa.tcustom is null
183 --left join "dbContact".tbcontact a3 on ( a3.id = aa.contactid )
184
185 left join "dbCalen".tbcalpart ab on ab.pid = a.id and ab.calroles='Receiver' and ab.tcustom is null
186 left join "dbContact".tbcontact a4 on ( a4.id = ab.contactid )
187
188 left join "dbCalen".tbcalpart ac on ac.pid = a.id and ac.calroles='Responsible' and ac.tcustom is null
189 left join "dbContact".tbcontact a5 on ( a5.id = ac.contactid )
190
191 left join "dbDoc".tbdoc a6 on a6.id = a.docid
192
193 /*
194 left join (
195 select
196 aa.pid taskid, array_to_string( array_agg( aa1.Title order by aa.orderno ), ',' ) results
197
198 from "dbPM".tbTKTag aa
199 left join "dbPM".tbpjtag aa1 on ( aa1.id = aa.MastID )
200 join "dbPM".tbtask aa2 on aa2.id = aa.pid and aa2.acc = accid
201 -- where aa.pid = a.id
202 group by aa.pid
203
204 ) t1 on t1.taskid = a.id
205
206 left join (
207 select
208 aa.pid taskid, array_to_string( array_agg( aa1.Title order by aa.orderno ), ',' ) results
209
210 from "dbPM".tbTKRes aa
211 left join "dbPM".tbPJRes aa1 on ( aa1.id = aa.MastID )
212 join "dbPM".tbtask aa2 on aa2.id = aa.pid and aa2.acc = accid
213 --where aa.pid = a.id
214 group by aa.pid
215
216 ) t2 on t2.taskid = a.id
217 */
218
219 left join lateral (
220 select
221 aa.pid taskid, array_to_string( array_agg( aa1.Title order by aa.orderno ), ',' ) results
222
223 from "dbPM".tbTKTag aa
224 left join "dbPM".tbpjtag aa1 on ( aa1.id = aa.MastID )
225 join "dbPM".tbtask aa2 on aa2.id = aa.pid and aa2.acc = accid
226 where aa.pid = a.id -- lateral
227 group by aa.pid
228
229 ) t1 on t1.taskid = a.id
230
231 left join lateral (
232 select
233 aa.pid taskid, array_to_string( array_agg( aa1.Title order by aa.orderno ), ',' ) results
234
235 from "dbPM".tbTKRes aa
236 left join "dbPM".tbPJRes aa1 on ( aa1.id = aa.MastID )
237 join "dbPM".tbtask aa2 on aa2.id = aa.pid and aa2.acc = accid
238 where aa.pid = a.id -- lateral
239 group by aa.pid
240
241 ) t2 on t2.taskid = a.id
242 where
243 --a00.UID in (select z.UID from "dbUserAcc".tbaccuser z where z.PID = AccID )
244 --a.acc = accid
245 --a.UID in (select z.UID from "dbUserAcc".tbaccuser z where z.PID = AccID )
246 case
247 when idd is null then a.acc=accid -- a.UID in (select a1.UID from "dbUserAcc".tbaccuser a1 where a1.PID = AccID )
248 else a.id = idd
249 end
250 /*
251 and case
252 when idd is null then true
253 else a.id = idd
254 end */
255 and case
256 when _idgrp is null then true
257 else a.idgrp = _idgrp
258 end
259
260 order by z.path
261 ;
262end;
263$$ LANGUAGE plpgsql ;
264 /*
265 perform InsUpdCalen(
266 new.Startdate, new.Finishdate,new.Complete
267 ,old.Startdate, old.Finishdate,old.Complete
268 ,(select planCalTaskID from "dbPM".tbtask where id = new.id )::int
269 );
270 */
271drop function if exists "dbPM".InsUpdCalen(
272 in newStartdate timestamp_wtz, in newFinishdate timestamp_wtz,in newComplete numeric, in newDescription text
273 ,in oldStartdate timestamp_wtz, in oldFinishdate timestamp_wtz,in oldComplete numeric, in oldDescription text
274 ,in newCalTaskID int
275 ,in newTitle text, in oldTitle text
276 ,in TitleSuffix text
277 ,in newid int
278 ,in CalenNameID int
279 ,in newUID int
280 ,in newACC int
281
282 ,out CalTaskID int
283 );
284
285
286create or replace function "dbPM".InsUpdCalen(
287 in newStartdate timestamp_wtz, in newFinishdate timestamp_wtz,in newComplete numeric, in newDescription text, in newwholeday boolean
288 ,in oldStartdate timestamp_wtz, in oldFinishdate timestamp_wtz,in oldComplete numeric, in oldDescription text, in oldwholeday boolean
289 ,in newCalTaskID int
290 ,in newTitle text, in oldTitle text
291 ,in TitleSuffix text
292 ,in newid int
293 ,in CalenNameID int
294 ,in newUID int
295 ,in newACC int
296
297 ,out CalTaskID int
298 )
299returns int as $$
300declare sql text;
301begin
302 -- raise notice 'calctakid %', caltaskid;
303 if newcalTaskID is not null then
304 -- Main
305 sql :=null;
306 sql := "dbSys".sqlSetValue( oldStartDate, newStartDate, sql, 'StartDate' );
307 sql := "dbSys".sqlSetValue( oldFinishDate, newFinishDate, sql, 'FinishDate' );
308 sql := "dbSys".sqlSetValue( oldComplete, newComplete, sql, 'Complete' );
309 sql := "dbSys".sqlSetValue( oldDescription, newDescription, sql, 'Description' );
310 sql := "dbSys".sqlSetValue( oldTitle, newTitle, sql, 'title' );
311 sql := "dbSys".sqlSetValue( oldwholeday, newwholeday, sql, 'wholeday' );
312
313 if sql is not null then
314 sql := 'update "dbCalen".tbCalTask ' || sql ||
315 ' where id = '|| newcalTaskID ;
316 --raise notice '214 %',sql;
317 execute sql ;
318 end if;
319 CalTaskID := NewCalTaskID;
320 else
321
322 --* create calendar task
323 insert into "dbCalen".tbCalTask( Title,TaskType, StartDate,FinishDate, WholeDay, CalenNameID, UID, ACC
324 ,complete
325 ,description
326 ,wholeday
327 )
328 select
329 -- 'Receive Date - Legal Case'
330 concat_ws( ' ', newtitle, '-'
331 -- ,new.id
332 ,TitleSuffix
333 ,'-',newid
334 ) -- Just a dummy record, make it unique by using title accompany with id .
335 ,null -- tasktype
336 ,newStartDate
337 ,newFinishDate
338 ,false
339 ,CalenNameID
340 ,newUID, newACC
341 ,newcomplete
342 ,newDescription
343 ,newwholeday
344 returning ID into calTaskID;
345 end if;
346end $$ language plpgsql;
347
348-- * How to update underlying tables whose data is projected to this view
349drop function if exists "dbPM".tbTaskVW_UpdData() cascade;
350create or replace function "dbPM".tbTaskVW_UpdData()
351returns trigger as $$
352declare sql text; planWork record; actWork record;
353 CalenNameID int;
354 rec record;
355begin
356 if TG_OP in ('INSERT', 'UPDATE') then
357 select a.CalenNameID from "dbPM".tbProject a where id = new.pid into CalenNameID;
358
359 end if;
360 if (TG_OP = 'INSERT') then
361
362 --* Plan work
363 --if ( new.startdate is not null) or (new.finishdate is not null ) or (new.complete is not null ) then
364 /*
365 if true then
366
367
368 --* Get Calendar name id
369 select a.CalenNameID from "dbPM".tbProject a where id = new.pid into CalenNameID;
370
371 --* create calendar task
372 insert into "dbCalen".tbCalTask( Title,TaskType, StartDate,FinishDate, WholeDay, CalenNameID, UID, ACC
373 ,complete
374 )
375 select
376 -- 'Receive Date - Legal Case'
377 concat_ws( ' ', new.title, '-'
378 -- ,new.id
379 ,'plan'
380 ,'-',new.id
381 ) -- Just a dummy record, make it unique by using title accompany with id .
382 ,null -- tasktype
383 ,new.StartDate :: date
384 ,new.FinishDate :: date
385 ,false
386 ,CalenNameID
387 ,new.UID, new.ACC
388 ,new.complete
389 returning ID into planWork;
390 else
391 select null::int id into planWork;
392 end if;
393
394 --* Actual work
395 if ( new.actualstart is not null) or (new.Actualfinish is not null ) then
396 --* Get Calendar name id
397 select a.CalenNameID from "dbPM".tbProject a where id = new.pid into CalenNameID;
398
399 --* create calendar task
400 insert into "dbCalen".tbCalTask( Title,TaskType, StartDate,FinishDate,WholeDay, CalenNameID, UID, ACC )
401 select
402 -- 'Receive Date - Legal Case'
403 concat_ws( ' ', new.title, '-'
404 -- ,new.id
405 ,'actual'
406 ,'-',new.id
407 ) -- Just a dummy record, make it unique by using title accompany with id .
408 ,null -- tasktype
409 ,new.ActualStart :: date
410 ,new.ActualFinish :: date
411 ,false
412 ,CalenNameID
413 ,new.UID, new.ACC
414 returning ID into actWork;
415 else
416 select null::int id into actWork;
417 end if;
418 */
419 --* Insert record
420 insert into "dbPM".tbtask (
421 --title ,PlanCalTaskID,ActualCalTaskID, pid ,idgrp
422 title , pid ,idgrp
423
424 ,PredecessorID
425 ,uid, acc
426 ) values (
427 --new.title ,planWork.id ,ActWork.id, new.pid, new.idgrp
428 new.title ,new.pid, new.idgrp
429
430 ,new.PredecessorID
431 ,new.uid, new.acc
432 )
433 returning id, plancaltaskid, actualcaltaskid, uid, acc
434 into new.id , new.plancaltaskid, new.actualcaltaskid, new.uid, new.acc
435 ;
436
437 --raise notice '334 new.uid % , new.acc %', new.uid, new.acc;
438
439 --* Plan work
440 select CalTaskID from "dbPM".InsUpdCalen(
441 new.Startdate, new.Finishdate,new.Complete, new.description, new.wholeday
442 --,old.Startdate, old.Finishdate,old.Complete
443 ,null, null, null, null , null
444
445 ,new.planCalTaskID
446 ,new.title, null::text
447 ,'Plan'
448 ,new.id
449 , CalenNameID
450 ,new.uid
451 ,new.acc
452
453 ) into new.planCalTaskID ;
454
455 -- raise notice '352 new.uid % , new.acc %', new.uid, new.acc;
456
457
458 --* Actual work
459 if new.ActualCalTaskID is not null then
460
461 select CalTaskID from "dbPM".InsUpdCalen(
462 new.ActualStart, new.ActualFinish,new.ActualComplete,new.description , new.wholeday
463 --,old.ActualStart, old.ActualFinish,old.ActualComplete
464 ,null, null, null, null , null
465 ,new.ActualCalTaskID
466 ,new.title, null::text
467 ,'Actual'
468 ,new.id
469 , CalenNameID
470 ,new.uid
471 ,new.acc
472 ) into new.ActualCalTaskID ;
473 end if;
474 --* Move latest to last
475 -- perform "dbSys".grpMove_ID_BOT(new.id, '"dbPM".tbtask' );
476
477 --* Add resouces
478 if new.resources is not null then
479 perform "dbPM".tbTask_InsUpd_Resources( new.Resources, null, new.id, new.pid );
480 end if;
481 --raise notice '369';
482 --* Add tags
483 if new.tags is not null then
484 perform "dbPM".tbTask_InsUpd_Tags( new.Tags, null, new.id, new.pid , '"dbPM".tbTKTag', '"dbPM".tbpjtag' );
485 end if;
486 --raise notice '374';
487 --* Add Schema, table and function
488 if new.DBSchema is not null then
489 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'DB Schema',new.dbschema,new.id );
490 end if;
491 if new.DBTable is not null then
492 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'DB Table',new.dbTable,new.id );
493 end if;
494 if new.DBFunction is not null then
495 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'DB Function',new.dbFunction,new.id );
496 end if;
497 if new.ManDay is not null then
498 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'Man-Day',new.Manday,new.id );
499 end if;
500 if new.Remark is not null then
501 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'Remark',new.Remark,new.id );
502 end if;
503
504 --raise notice '392, new.Complete %', new.Complete;
505
506 if new.Complete is not null then
507 insert into "dbPM".tbtkfield (title,tvalue,pid) values ( 'Complete',new.Complete::text,new.id );
508 end if;
509
510 return NEW;
511 elseif (TG_OP = 'UPDATE') then
512 -- raise notice '407 new.manday %, new.planCalTaskID %, new.ActualCalTaskID %', new.manday, new.planCalTaskID, new.ActualCalTaskID;
513
514 --* Plan work
515 select CalTaskID from "dbPM".InsUpdCalen(
516 new.Startdate, new.Finishdate,new.Complete, new.description, new.wholeday
517 ,old.Startdate, old.Finishdate,old.Complete, old.description, old .wholeday
518 ,new.planCalTaskID
519 ,new.title, old.title
520 ,'Plan'
521 ,new.id
522 , CalenNameID
523 ,new.uid
524 ,new.acc
525
526 ) into new.planCalTaskID ;
527
528 --* Actual work
529 if new.ActualCalTaskID is not null then
530
531 select CalTaskID from "dbPM".InsUpdCalen(
532 new.ActualStart, new.ActualFinish,new.ActualComplete, null
533 ,old.ActualStart, old.ActualFinish,old.ActualComplete, null
534 ,new.ActualCalTaskID
535 ,new.title, old.title
536 ,'Actual'
537 ,new.id
538 , CalenNameID
539 ,new.uid
540 ,new.acc
541 ) into new.ActualCalTaskID ;
542 end if;
543
544 -- Main
545 sql :=null;
546 --sql := "dbSys".sqlSetValue( OLD.Title, NEW.Title, sql, 'Title' );
547 sql := "dbSys".sqlSetValue( OLD.idgrp, NEW.idgrp, sql, 'idgrp' );
548 sql := "dbSys".sqlSetValue( OLD.planCalTaskID, NEW.planCalTaskID, sql, 'planCalTaskID' );
549 sql := "dbSys".sqlSetValue( OLD.ActualCalTaskID, NEW.ActualCalTaskID, sql, 'ActualCalTaskID' );
550 sql := "dbSys".sqlSetValue( OLD.uid, NEW.uid, sql, 'uid' );
551 if sql is not null then
552 sql := 'update "dbPM".tbTask ' || sql || ' where id = '|| new.id ;
553 execute sql ;
554 end if;
555
556 -- raise notice '448 new.manday %, new.planCalTaskID %, new.ActualCalTaskID %', new.manday, new.planCalTaskID, new.ActualCalTaskID;
557
558
559 -- Resource change
560 if diff(new.resources, old.resources ) then
561 --raise notice '480';
562 perform "dbPM".tbTask_InsUpd_Resources( new.Resources, old.resources, new.id, new.pid );
563 end if;
564
565 if diff(new.tags, old.tags ) then
566 perform "dbPM".tbTask_InsUpd_Tags( new.tags, old.tags, new.id, new.pid , '"dbPM".tbTKTag', '"dbPM".tbpjtag' );
567 end if;
568
569 --* Edit db Schema, table, function
570 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'DB Schema', null,OLD.DBSchema,NEW.DBSchema,'TValue' );
571 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'DB Table', null,OLD.DBTable,NEW.DBTable,'TValue' );
572 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'DB Function', null,OLD.DBFunction,NEW.DBFunction,'TValue' );
573
574 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'Man-Day', null,OLD.manday,NEW.manday,'TValue' );
575
576 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'Remark', null,OLD.Remark,NEW.Remark,'TValue' );
577 perform "dbContact".updContactChild( '"dbPM".tbTkField', NEW.id ,'Complete', null,OLD.Complete::text,NEW.Complete::text,'TValue' );
578
579 return NEW;
580 elseif TG_OP = 'DELETE' then
581
582 --delete from "dbPM".tbTask where id = old.id;
583 perform "dbSys".grpdelete(old.id, '"dbPM".tbtask');
584 return OLD;
585 end if;
586end ; $$ LANGUAGE plpgsql;
587
588
589
590/*****************************
591 View registration
592******************************/
593select "dbSys".viewRegistration( '"dbPM".tbTaskVW'
594 -- , pers := '"dbPM".tbTask'
595 , _delete_system_data := false
596 --,_init_data := true, _init_data_uid := varint('userid') ,_init_data_acc := null
597 --,_init_data := true, _init_data_uid := varint('userid') ,_init_data_acc := varint('accid')
598
599 , _init_sysorg := true
600 ,_init_count := 'c_task'
601 -- ,_fnCheckPost := 'sumamt' -- Field to check cannot be changed when refered by posting data source
602
603 -- ,_matview :=true
604 -- ,_mvAccID_share := 4
605 --,_mvOrderBy := 'firstname, lastname'
606 --,_mvStrict := true -- Check data is in scope of view when insert
607
608);
609/*
610select "dbSys".viewRegistration( '"dbInventory".tbInvenVW'
611 -- ,pers := '"dbInventory".tbinven'
612 ,_delete_system_data := false
613 ,_init_data := true, _init_data_uid := varint('userid'),_init_data_acc := null -- varint('accid')
614 , _init_sysorg := true
615
616);
617
618*/
619
620
621
622
623/************************************************************
624 Registration : inheritance
625
626 select * from "dbSys".tbinrregis where sch = 'dbLegal' and nam = 'tbpinvvw'
627 select * from "dbSys".tbinrregis where sch = 'dbFinance' and nam = 'tbpinvvw'
628 select * from "dbSys".tbinrregis where sch = 'dbFinance' and nam = 'tbpreqvw'
629
630*************************************************************/
631--select "dbSys".tblRegistration_Inherit( '"dbPM".tbtaskvw','"dbCalen".tbcaltaskvw', false, false, true );
632
633
634/********************************************************
635 Logg Handling : Register for logging
636********************************************************/
637
638-- select "dbSys".logRegistration( '"dbPM".tbTaskVW' ,'title' );
639
640
641/***************
642 create view
643*********************/
644select * from "dbSys".tvCreateView ( varint('userid'), varint('accid'), '"dbPM".tbTask' ,dropit:=true );