A very basic example of V7 style coding with Representation and Class.

4 minute read time.

For those of you who have had experiences, developing with V6 style coding, you are most comfortable with terminologies, like Object, Windows and screens.

Starting with V7 you most likely noticed new functions under your development, things such as Representation and a class and you may have wondered what are those?

Also if you recall from your Development training provided by SageU , as part of the course there was an exercise to create an object that manages all the read and write for a primary table, in this blog my goal is to show a very basic example of the same exercise but with the representation and class, to break the ice in some degree.

In this basic example I am going to create a table, and use a class to manage the table, and make a representation of the class to show it as part of a menu.

Part one: Create a basic table. (Similar to how you have done it in past)

  1. Open Development, Tables, Tables.
  2. Create a new table.
  3. Save and Validate.




Part two: Create a class to manage the operations for the table.

  1. Open Development, Data and parameters, Classes, Classes.
  2. Click New.
  3. Enter a class name, similar to the table name.
  4. Select Persistent as the type.
  5. Enter the table you created on part one as the table-view.






  6. Click on Properties tab and from the action select Column selection.




  7. By default, everything on the table is marked as Yes, keep it that way and click Ok.




  8. This will add all the table fields and properties on the class.




  9. Click Create.
  10. On the standard Methods tab select all the methods that you like this class to manage, such as Creation, Deletion, Read etc.




  11. Click Save and Validation.

Part Three: Create a representation for the class.

  1. Open Development, Data and parameters, Classes, Representations.
  2. Click New.
  3. Enter a representation name and description.
  4. For the class select the class you created on prier section.
  5. Check mark proper behaviors you like it to be managed.




  6. Click on Organization tab and create Sections and blocks, later on you will see how they will look like when you open the representation.






  7. Click on Displayed Properties.
  8. For the Alias use the magnifying glass and select the properties of your class you like to display. 



  9. Select the block you like this property to be displayed on.





  10. Define what Facet you like this property to be displayed on, in this simple example, I am going to select Detail and Edit and Query Facet.




  11. Enter any other class property you like to display.




  12. Click Save and Validate. 

 

Part Four: Create a menu item to point to your representation

  1. Open Administration, Authoring, Pages, Menu Items. 
  2. Click New.
  3. Enter a code and title.
  4. Select Representation as the link Type.
  5. Enter the name of the representation for the Representation field and Entity field.

Things you can do now:


Now you click simply click on the menu item and look at the result, by default you are in the query facet.

You can click on Create and go to Creation mode and enter a new record.



Conclusion:

You can setup a Class and a Representation to manage all the CRUD operation on a table.

What is next:

In future blogs I am going to show how you can make this representation Searchable in Elastic search and how you can manage two tables like a header and line.