To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Cancel

Quickstart building a web application (desktop style)

Lesson 5: Creating the Media View

In this last lesson the Media View will be created. 

  1. Define the Media Table. A relation between the Media and Person Table will be created. The Person Table is the Parent of the Media Table.
  2. Define the business rules on top of the Media Table. These are defined in the Data Dictionary. We’re going to add a validation table that allows you to select the media type from a list of specific types. 
  3. Create the Media View, by using a template. 
  4. Test the Media View.
  5. Create the lookup, the dialog that helps to easily select records.


Define the Media Table

  1. Click the Create New Table.
  2. Enter the Table Name: Media
  3. Add the following fields:
    - MediaId, Numeric, 8,0
    - PersonId, Numeric, 8,0
    - Title, ASCII, 100,0
    - Author, ASCII, 60,0
    - Type, ASCII, 8,0
    - PurchaseDate, Date, 6,0
    - Price, Numeric, 4,2
  4. Define the Relationships by clicking the Relationships tab.
  5. Click on Add Relationship.
  6. Choose the table we want to relate to, in this case the Person table.
  7. Select the fields on both tables that will define the relation. The first is creating a relationship between the PersonId in Media and in Person.
  8. Define the Index.
  9. Got to Indexes and click Add Index.
  10. Create a unique index for MediaId.
  11. The second Index will be used for the relationship. Select PersonId and MediaId.
  12. Create some Indexes to sort on, in this case:
    - Title
    - PersonId
    - MediaId
  13. The fourth Index contains also indexes to sort on:
    - Author
    - Title
    - PersonId
    - MediaId


Create Data Dictionary

  1. The Studio already generated an empty Data Dictionary:
  2. Select Auto Increment and choose Sysfile, MediaId:
  3. Set Protect Vavlue to True by double clicking it:
  4. In the left column select Title:
  5. Mark as required:
  6. Do the same for Author.
  7. Select Price:
  8. For the Price select Mask Type and choose Mask_Currency_Window:
  9. Next step is setting up Validation Objects. First select Type in the left column. Then select Validation Objects. Click on Add Validation Object:
  10. Set the name to oMediaType and apply it to the Type column.
  11. Enter the options that will be available for this field. In this Quickstart:
    - CD
    - DVD
    - Book
    - Mp3
    - Other
  12. We will make this Combo field as a pull down. Go back to the tab Columns.
  13. Make sure the Type column is still selected. Go to Visual Control and select Combo.
  14. Save the Data Dictionary.


Define the View 

  1. Go to Create New and select the Web View.
  2. Note: we don’t choose the Web View Wizard in this case, but the Web View Template. This is a bit simpler.
  3. Give the Object Name oMediaView and the caption Media.
  4. It immediately generates a basic structure for the view.
  5. Previewing this, there is one example field.
  6. Delete this example by right click and choosing Delete.
  7. To add a field again choose DDO Explorer and click on Add DDO.
  8. Now the Data Dictionary needs to be chosen. In this case the Media data dictionary.
  9. It immediately also adds the Person Data Dictionary because it’s the parent. Based on the relationship that’s defined earlier.
  10. Selecting the DDO Column Selector we can select the fields we want on our view. In this case:
    - MediaId
    - PersonId
    - Title
    - Author
    - Type
  11. Select the fields and drag them to the View.
  12. Note that Type automatically became a Combo form.
  13. In the previous list we didn’t select the PurchaseDate. To add the date go to Class Palette.
  14. Select the cWebDataForm.
  15. Drag the DateForm and drag it after the Type field.
  16. Because it’s dragged from the Class Palette it needs to bind to the database field manually.
  17. Go to Properties, Binding.
  18. Select the Data Source and select oMedia_DD, PurchaseDate.
  19. In the Properties panel the Label can be changed. In this Quickstart we change it from dateform to Purchase date.
  20. Go back to the View. The PersonId isn’t needed in this case. Right click it and choose Delete.
  21. Now change the sizes and the order of the fields in the View. For this Quickstart we do it this way:
  22. Note that we didn’t add any fields from our parent table. We’re going to add that later.
  23. Now we will add a Group.
  24. Select Web Containers, cWebGroup, from the Class Palette.
  25. Drag it after the Price field.