A-3070 Try to define a default value for Interactive Grid checkbox and switch columns.
Reason
A checkbox or switch column shows "unchecked" or "off" for a new row, but without a default the row starts with an empty value instead of the unchecked value. Unless the user toggles the control, the row can be saved with NULL, which breaks a NOT NULL column or code that expects Y/N.
Set the column's Default to the unchecked value (for example type Static with N/false). If NULL is a valid state for the column, the default can stay empty.
Example
Non-Compliant Example
page 10 (
// ...
region orders (
name: Orders
// ...
advanced {
htmlDomId: orders
}
column IS_PAID (
type: checkbox
// ...
// no default
)
)
) | Line | Column | Message |
|---|---|---|
| 10 | 16 |
Compliant Solution - ★★★★★
page 10 (
// ...
region orders (
name: Orders
// ...
advanced {
htmlDomId: orders
}
column IS_PAID (
type: checkbox
// ...
default {
type: static
staticValue: N
}
)
)
) Tests
Test SQL query
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(r.static_id, to_char(r.region_id)) || '.' || c.name as identifier,
'Column ' || c.name || ' of Interactive Grid ' || c.region_name || ' on page ' || c.page_id || ' of app ' || aa.alias
|| ' in ' || aa.workspace || ' is a checkbox or switch without a default value for new rows.' as message
from apex_appl_page_ig_columns c
join apex_application_page_regions r
on r.application_id = c.application_id
and r.region_id = c.region_id
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and c.item_type in ('NATIVE_SINGLE_CHECKBOX', 'NATIVE_YES_NO')
and c.default_type_code is null
and exists (select 1
from apex_appl_page_igs ig
where ig.application_id = c.application_id
and ig.region_id = c.region_id
and ig.is_editable = 'Yes')Test results
| Identifier | Message | Migration |
|---|---|---|
| WORKSPACE.CUSTOMERS.10.orders.IS_PAID | Column IS_PAID of Interactive Grid Orders on page 10 of app CUSTOMERS in WORKSPACE is a checkbox or switch without a default value for new rows. | - |
Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| ApexWorkspaces | Comma-separated List of APEX workspaces owning APEX applications to check. | dblinter, dbl_gui |
References
- same as UC-3070