Project specific validations

  • 16 October 2020
  • 0 replies
  • 45 views

Userlevel 2
Badge +2

Goal

In projects you can make agreements with the customer and the development team about, for example, naming conventions for the data model, design of the GUI model or design of screen types. Examples of this are:

  1. Columns ending on "_nr" or "_number" should always have a numeric domain.
  2. Form fields have a standard width, which may only be deviated from in exceptional cases.
  3. When a column is determined to be an email address, then the column name should contain the text "email_address".
  4. A toolbar, report bar, prefilter bar and global filter are always on all screen types, also in the same position.

These types of agreements ensure a consistent data model, GUI model which offers advantages for developers, administrators and users.

Solution

You can add your own validations to check for deviations from the agreements. If an exception has to be made, this can be done by approving the validation message.

 

Validation examples:

/*
A column ending on "_nr" should always be numeric.
*/
insert validation_msg
select
@project_id,
@project_vrs_id,
@validation_id,
@project_id as pk_col_1,
@project_vrs_id as pk_col_2,
c.tab_id as pk_col_3,
c.col_id as pk_col_4,
null as pk_col_5,
null as pk_col_6,
null as pk_col_7,
0,
dbo.tsf_user(),
getdate(),
dbo.tsf_user(),
getdate()
from col c
join dom d
on d.project_id = c.project_id
and d.project_vrs_id = c.project_vrs_id
and d.dom_id = c.dom_id
join dttp dt
on dt.prog_lang_id = d.prog_lang_id
and dt.dttp_id = d.dttp_id
where d.project_id = @project_id
and d.project_vrs_id = @project_vrs_id
and c.col_id like '%[_]nr'
and dt.dttp_type <> 0

/*
A form-field should be the default width of the project.
*/
insert validation_msg
select
@project_id,
@project_vrs_id,
@validation_id,
@project_id as pk_col_1,
@project_vrs_id as pk_col_2,
c.tab_id as pk_col_3,
c.col_id as pk_col_4,
null as pk_col_5,
null as pk_col_6,
null as pk_col_7,
0,
dbo.tsf_user(),
getdate(),
dbo.tsf_user(),
getdate()
from col c
join dom d
on d.project_id = c.project_id
and d.project_vrs_id = c.project_vrs_id
and d.dom_id = c.dom_id
where c.project_id = @project_id
and c.project_vrs_id = @project_vrs_id
and c.field_width is not null
and (d.control_id not in ('CHECKBOX') or d.control_id is null)

/*
When a column is determined to be an email address, then the column name should contain the text "email_address".
*/
insert validation_msg
select
@project_id,
@project_vrs_id,
@validation_id,
@project_id as pk_col_1,
@project_vrs_id as pk_col_2,
c.tab_id as pk_col_3,
c.col_id as pk_col_4,
null as pk_col_5,
null as pk_col_6,
null as pk_col_7,
0,
dbo.tsf_user(),
getdate(),
dbo.tsf_user(),
getdate()
from dom d
join col c
on c.project_id = d.project_id
and c.project_vrs_id = d.project_vrs_id
and c.dom_id = d.dom_id
where d.project_id = @project_id
and d.project_vrs_id = @project_vrs_id
and d.control_id = 'EMAIL'
and c.col_id not like '%email[_]adres%'

/*
The combined filter seems to be incorrect on the screentype.
*/
insert validation_msg
select
@project_id,
@project_vrs_id,
@validation_id,
@project_id as pk_col_1,
@project_vrs_id as pk_col_2,
st.screen_type_id as pk_col_3,
null as pk_col_4,
null as pk_col_5,
null as pk_col_6,
null as pk_col_7,
0,
dbo.tsf_user(),
getdate(),
dbo.tsf_user(),
getdate()
from screen_type st
join screen_component sc
on sc.project_id = st.project_id
and sc.project_vrs_id = st.project_vrs_id
and sc.screen_type_id = st.screen_type_id
where st.project_id = @project_id
and st.project_vrs_id = @project_vrs_id
and st.generated = 0 --Only project specific screen types
and sc.screen_component_type_id = 'CombinedFilter'
and (sc.region <> 0 /* Not on top */
or sc.dock <> 'right' /* Not on the right side */
)

 


0 replies

Be the first to reply!

Reply