Enable xlsform comments

1. What is the general goal of the feature?
Enabling comments on the "survey" page of xlsforms would make them easier to read and maintain. This could be done by adding a new question type (e.g., "comment") that the compiler would ignore as if it were a blank row. The survey developer could then add comments and explanations relevant to various parts of the survey logic. The comment and notes features of Excel do not work well for this purpose, because they do not remain on the original cell when rows are added or deleted, but must continually be moved by hand back to the proper location on the spreadsheet.

2. What are some example use cases for this feature?
Xlsform is in effect a sophisticated and powerful high-level programming language. Surveys can be quite lengthy, with complicated skip logic, external datasets, and many other features. Using extensive comments is generally good coding practice, essential for all but the shortest and simplest programs.

3. What can you contribute to making this feature a reality?
I would be happy to help review and test this feature.

I strongly agree that comments are key to maintaining complex forms. I extensively use Google Sheets comments and didn't realize that Excel linked comments to the absolute location of a cell. How frustrating.

Did you know that columns with names not part of the XLSForm spec are ignored by the converter? A common practice I've seen and recommended is to add a notes column, typically formatted in some way to stand out. For example, typed-calculates - Google Sheets shows a notes column in gray italics. I've also seen form designers include multiple notes columns including things like logic notes or relevance notes.

We don't have many of these best practices formally documented and would very much welcome PRs to add some in.

2 Likes

See also Survey Repository - #6 by lgorman re repo of example forms (e.g. solving certain challenges, incl things one might leave a form note to explain)

Thanks LN and Florian_May. The undocumented ability to use a dummy column for comments is certainly useful, but not as useful as I had hoped before I tried it. My form has four languages and more than 20 columns already, so adding one or more fairly wide columns is problematic. I tried adding a narrow dummy column to the left, planning to add a comment on a blank row that that would spill over to the blank columns to the right. The converter does not like this. It wants a question type, name, and label on each non-blank row. Enabling a comment row that the converter ignores would be far more flexible, allowing comments and notes in various cells across the row. Can this be done?

Silly suggestion, but would formatting comment cells as line wrapping blocks work in your case? That would keep all the note text visible within the set column width, albeit at the cost of increased row height.

1 Like

Let's really make sure that what you want to do can't be done with existing features.

First, I wasn't able to reproduce the behavior you describe with Microsoft Excel. When I put a comment on a cell, it remains associated with that cell as I add and remove rows and columns. Are you perhaps using an older version of Excel that might have a bug? Or could there maybe be a setting that modifies this behavior?

The approach @Florian_May is what I favor and typically use if actual comments feel too hidden. However, I see the point about horizontal space being at a premium. Another option is to have a very skinny first column that is used for comments. Here is an illustration of those two strategies:


xlsform_comments.xlsx (8.9 KB)

Using the skinny first column strategy, you don't have to put your comment in that first column. You could put comments in any column other than type, name, label or hint. I think this achieves what you're asking for without adding an additional type with special handling to the XLSForm spec.

LN, thanks for your further comments. Now that updates for this year's well functionality surveys are complete, I've experimented some more with comment options.

The attached screenshots illustrate the problems with Excel notes (now separated from Excel "comments")

. ExcelNote-1 shows the note properly centered over blank row 12. When I vertically shrink row 8, the note does not stay centered on row 12. Excel has misbehaved in this way for as long as I have used it, and continues to this day with the latest Office 365 update. A short VBA macro will quickly relocate the note to the proper row. Central will not compile the xlsm file but xlsform will. So VBA is one option to avoid repeatedly moving the note back to the proper row, at the expense of missing Central's handy ability to directly accept the Excel file.

Inserting a narrow column to the left, with text spilling over to blank cells to the right, also works, even though both the Central and xlsform compilers rap me on the knuckles with a warning. If I ignore the warning, the form seems to work just fine anyway. So, the skinny column A method is a good way to annotate different sections of the survey.

The embedded column approach also shows promise. On my surveys, I intend to add a Notes column between the relevant and calculation columns to the left and the appearance and constraint columns to the right. This would allow explanatory notes on the four adjacent columns, which govern access to external data, survey logic, data validation, etc.-- the most complex parts of the survey logic. And, of course, I would continue to use word wrap. The one thing to add is that the sheet should be formatted to center all cells vertically for easier reading.

In summary, using dummy columns for survey notes is a useful option. Thanks for alerting me to this feature.

All the best, Hayden

1 Like