You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first issue I have with the Web Form Report content type - packaged within
the Form Generator Module – is that it displays all columns even when they
contain no data.
Another issue also appears when you have multiple dependant fields that use the
same label names. This results in the creation of separate columns for each
field when it should really only be one.
This scenario might happen if for example you have a select box containing
countries, where you could then create separate dependant fields to contain the
cities for each country. This means you have one field labelled "Country" and
multiple dependant fields labelled "Cities" that will appear depending which
country has been chosen.
To get round this problem I have redeveloped the sections of code which is
responsible for collecting the columns in the CmsFormReport class. This section
lies between lines 518 and 535 in the CmsReportClass.java file.
The attached Patch file shows the changes I have made. In summary the new code
no longer uses the getAllFields method which retrieves all the fields
regardless of the data it may or may not contain. Instead I am using the same
collection method used by the column builder used to create the excel
spreadsheets and the backend database administrative form. This change alone
results in the collection of columns that only contain data.
The second improvement this change brings is that because it only retrieves the
columns that have been found in the database it prevents duplicate columns from
appearing.
The only downside to this approach is that the column tree structure has been
flattened. Sub fields and non sub fields are all listed alphabetically which
means a bit of work is then required to prevent sub fields from showing when
their parents have been filtered out.
After the patch file has been applied lines 533 and 548 will check to see if
the current field has sub fields and checks whether is has also been filtered
out. If this is true then a new list is created which adds all the subfields
that should also be removed from the columns list.
Once that has been done we confirm that the current field should be shown and
is not filtered out - either at its current or parent’s level.
The first issue I have with the Web Form Report content type - packaged within
the Form Generator Module – is that it displays all columns even when they
contain no data.
Another issue also appears when you have multiple dependant fields that use the
same label names. This results in the creation of separate columns for each
field when it should really only be one.
This scenario might happen if for example you have a select box containing
countries, where you could then create separate dependant fields to contain the
cities for each country. This means you have one field labelled "Country" and
multiple dependant fields labelled "Cities" that will appear depending which
country has been chosen.
To get round this problem I have redeveloped the sections of code which is
responsible for collecting the columns in the CmsFormReport class. This section
lies between lines 518 and 535 in the CmsReportClass.java file.
The attached Patch file shows the changes I have made. In summary the new code
no longer uses the getAllFields method which retrieves all the fields
regardless of the data it may or may not contain. Instead I am using the same
collection method used by the column builder used to create the excel
spreadsheets and the backend database administrative form. This change alone
results in the collection of columns that only contain data.
The second improvement this change brings is that because it only retrieves the
columns that have been found in the database it prevents duplicate columns from
appearing.
The only downside to this approach is that the column tree structure has been
flattened. Sub fields and non sub fields are all listed alphabetically which
means a bit of work is then required to prevent sub fields from showing when
their parents have been filtered out.
After the patch file has been applied lines 533 and 548 will check to see if
the current field has sub fields and checks whether is has also been filtered
out. If this is true then a new list is created which adds all the subfields
that should also be removed from the columns list.
Once that has been done we confirm that the current field should be shown and
is not filtered out - either at its current or parent’s level.
Thanks
http://bugzilla.opencms.org/attachment.cgi?id=331&action=view
Patch to prevent empty and duplicate columns from appearing in webformreport
The text was updated successfully, but these errors were encountered: