Build a Book Library with the Records Macro
Last modified by Eleni Cojocariu on 2026/11/25 11:30
Tutorial
XWiki 18.10.0+
In this tutorial, you will learn how to build a small library application, a table of books that readers can sort, filter and extend. You describe what a book is with an object type, then list the books with the Records Macro.
- Create a Page named "My Library", and a Page named "Book Class" under it, as described in Create a Page.
- Open "Book Class" with the Class editor, as described in Edit a Page with the Class Editor.
- Add the four fields of a book, one by one: type author in "Add new property", select the "String" type and click "Add", then add genre and status as "Static List", and year as "Number".

- Expand each field and set its "Pretty Name" to "Author", "Genre", "Status" and "Year".

- Type Novel|Essay|Poetry in the "Values" of "Genre", and To read|Reading|Read in those of "Status", then click "Save & View".

- Edit "My Library" with the WYSIWYG editor and insert the "Records" Macro, as described in Insert a Macro with the WYSIWYG Editor.
- Pick "Book Class" in "Object type".

- Check "Allow edit mode" in the "Editing" tab, and pick "Use user-submitted title as page name" as "Creation strategy".

- Click "Submit", then save the Page.
- Click the "Edit mode" button, showing a pencil icon, at the top of the table, click "Add entry", and type The Name of the Rose.

- Fill the other cells of the row, moving between them with the Tab key, then add the other books the same way:
Title Author Genre Status Year The Name of the Rose Umberto Eco Novel Read 1980 A Room of One's Own Virginia Woolf Essay Reading 1929 Leaves of Grass Walt Whitman Poetry To read 1855 Invisible Cities Italo Calvino Novel To read 1972 - Click the "Edit mode" button again.
- The library lists your books, which readers can sort and filter, as follows:

FAQ
Where are the books stored?
Each book is a Page under "My Library", named after its title, next to "Book Class".
Which rights do readers need to add books?
The Edit right on the children of "My Library", where the books are created. Readers without it can still sort and filter the table, but get no "Add entry" button.