Last modified by Eleni Cojocariu on 2026/11/25 11:30

Show last authors
1 {{version since="18.10.0RC1"}}
2 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>>doc:documentation.extensions.user.records.WebHome]] Macro.
3
4 1. Create a Page named "My Library", and a Page named "Book Class" under it, as described in [[Create a Page>>doc:documentation.xs.user.page.create.WebHome]].
5 1. Open "Book Class" with the Class editor, as described in [[Edit a Page with the Class Editor>>doc:documentation.xs.user.content-edit.class-editor.WebHome]].
6 1. 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".(((
7 {{image reference="class-add-fields.png" size="large" alt="The Class editor of Book Class, with the Add new property row highlighted above the Author, Genre, Status and Year fields"/}}
8 )))
9 1. Expand each field and set its "Pretty Name" to "Author", "Genre", "Status" and "Year".(((
10 {{image reference="class-pretty-name.png" size="large" alt="The author field expanded in the Class editor, with Author typed as its Pretty Name"/}}
11 )))
12 1. Type ##Novel|Essay|Poetry## in the "Values" of "Genre", and ##To read|Reading|Read## in those of "Status", then click "Save & View".(((
13 {{image reference="class-list-values.png" size="large" alt="The Values setting of a Static List field, holding Novel, Essay and Poetry separated by vertical bars"/}}
14 )))
15 1. Edit "My Library" with the WYSIWYG editor and insert the "Records" Macro, as described in [[Insert a Macro with the WYSIWYG Editor>>doc:documentation.xs.user.content-edit.edit-standalone-wysiwyg-editor.insert-macro.WebHome]].
16 1. Pick "Book Class" in "Object type".(((
17 {{image reference="pick-book-class.png" size="large" alt="The Records Macro dialog with Book Class picked as Object type"/}}
18 )))
19 1. Check "Allow edit mode" in the "Editing" tab, and pick "Use user-submitted title as page name" as "Creation strategy".(((
20 {{image reference="allow-adding-books.png" size="large" alt="The Editing tab of the Records Macro dialog, with Allow edit mode checked and the creation strategy naming pages after their title"/}}
21 )))
22 1. Click "Submit", then save the Page.
23 1. 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##.(((
24 {{image reference="add-book-row.png" size="extra" alt="The empty table in Edit mode, with a new row holding the title The Name of the Rose being typed"/}}
25 )))
26 1. Fill the other cells of the row, moving between them with the Tab key, then add the other books the same way:(((
27 |=Title|=Author|=Genre|=Status|=Year
28 |The Name of the Rose|Umberto Eco|Novel|Read|1980
29 |A Room of One's Own|Virginia Woolf|Essay|Reading|1929
30 |Leaves of Grass|Walt Whitman|Poetry|To read|1855
31 |Invisible Cities|Italo Calvino|Novel|To read|1972
32 )))
33 1. Click the "Edit mode" button again.
34 1. The library lists your books, which readers can sort and filter, as follows:(((
35 {{image reference="library-table.png" size="extra" alt="The My Library page listing four books with their title, author, genre, status and year"/}}
36 )))
37 {{/version}}

Get Connected