Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Form Report shows duplicate and empty columns #12

Open
pStrudthoff opened this issue Apr 5, 2012 · 0 comments
Open

Web Form Report shows duplicate and empty columns #12

pStrudthoff opened this issue Apr 5, 2012 · 0 comments

Comments

@pStrudthoff
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant