Apex 5 Upgrade – correct colspan error

After upgrading to Apex 5 and switching to the new Universal Theme you might encounter an error regarding column spans. The error message will look similiar to this: “Label of Page Item P1_XXX cannot be rendered as the label column span grid setting for this page item is invalid …”

apex5_upgrade_colspan_en or the german version apex5_upgrade_colspan_de

I had the problem for an application which was gradually upgraded from Apex 4.0 to Apex 4.1 to 4.2 and now to Apex 5. During this, almost all form page items had the attribute colspan set to 1. This makes trouble with the new Universal Theme. I had more than 1500 items that needed to be changed. So clearly this was not a task to do manually.

Reason

The reason for this error is based upon how the Universal Theme handles items and its labels in combination with the page template. The standard page will use a fixed number of 12 columns in a grid to render anything. The labels will span 3 columns already. This is the default. If you have a column span set of 1, then this will include the label column span. And that is what the error message is all about.

Btw: This is also one reasons why the form pages now “waste” much more screen space than before. I changed this in the page template to a column span of 2. If you change it to 1 then this might be too small. The labels will then often be wrapped onto the next line.

Finding all items

We can use the apex dictionary to find all items that are affected.

Application Builder / Utilities / Item Utilities / All Page Items

I set a filter on “Column Span is not null”. Then the report shows many items we have in the application that have thios attribute set.

Another way to do the same is to run the follow select statement:

select * 
from apex_application_page_items
--where workspace = 'MYWORKSPACE'
where workspace != 'INTERNAL'
and application_id = 200
and column_span = 1;

Single page correction
If it is a low number of pages that is affected, we can do the change for all items on one page. From the report that shows all the items, we can navigate to the multi edit “pages” form.

apex5_upgrade_colspan_page

There we can update all items for one page easily and fast.

All pages mass correction

If we have more than just a few pages, an even faster way is needed.

You need DBA privileges to do this mass update.
As an alternative you could try the update on the view via the SQL workshop. I didn’t test that.
An update on database level to the view will give you
ORA-01031: insufficient privileges
The update can be done directly on the apex internal table wwv_flow_step_items.
Here is how to mass update your application and set the column span to NULL.

The example changes all items in application 200. Adapt to your workspace and application id.

-- set environment
alter session set current_schema = apex_050000;
execute wwv_flow_security.g_security_group_id := 200000;

-- pre update check
select count(*) --colspan
from wwv_flow_step_items i
where flow_id = 200
and colspan = 1;

-- do the change
update wwv_flow_step_items i
set colspan = null
where flow_id = 200
and colspan = 1;

-- does the result match the pre update check
1,128 rows updated.

-- save 
commit;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s