Filtering CSV data from PloneFormGen for display

Developing a site with Plone 5.0.6 and PloneFormGen 1.8.3 that will take registration information from anonymous users (specifically, registering teams for a tournament).

I would like a public view of the teams that have registered that won't include every bit of information collected.

So far, I've got a PFG FormFolder with all my fields, and two FormSaveDataAdapters (one saving every field into a CSV, one saving only the public fields into a second CSV).

When I enable anonymous viewing and downloading of the CSV data, and then set the smaller, public CSV view to a Tabular View, I get headers for every field in the FormFolder, and data lines for just the few fields I want to make public. That is, I get 11 columns of headers, and 5 of actual data, as shown below:

How can I limit the data's display to just the few columns I'm saving, instead of having it pull from every field in the FormFolder?

I'm obviously willing to do this entirely differently if needed. Would rather not drop back to Plone 4 or use a third-party tool (Google Docs, for example) unless there's no better option.

Try uwosh.pfg.d2c ... it creates content items from submitted PFG forms, then you can create a custom view template that behaves differently for anonymous role.

Will start looking at d2c, thanks. But since the download of a PFG correctly puts the correct column headers in the CSV file, shouldn't the same logic be applicable to the view?

EDIT: looks like I've found a bug in PFG. Editing Products/PloneFormGen/content/saveDataAdapter.py so that getColumnTitles is

def getColumnTitles(self, excludeServerSide=True):
    # """Returns a list of column titles"""

    showFields = getattr(self, 'showFields', [])
    names = [field.widget.label for field
             in self.fgFields(displayOnly=True, excludeServerSide=excludeServerSide)
             if not showFields or field.getName() in showFields]
    for f in self.ExtraData:
        names.append(self.vocabExtraDataDL().getValue(f, ''))

    return names

to match the logic of getColumnNames, I get a set of titles that match the fields in the SaveDataAdapter.

It's certainly possible that it's a bug, though I wonder if maybe there is a reason why those column headers would still be needed.

Could you file the issue and make a pull request?

Have a pull request in now. If I need to make an issue as well, I can.

1 Like

you are really getting into the usecases that Plomino is much better at. It gives you a full filtering and customisable view facility to make multiple kinds of listings of the same data. It also doesn't encumber your site with content objects to get simple simple database functionality like d2c does. In the process you more flexible forms with more layouts possible and skip logic. Stay tuned for an upcoming update which lets you do all of the above in a more WYSIWYG way and without writing any python formulas.

Merged as of a few hours ago.

1 Like