First view
Last time we created a project in the DataFlex Studio and this time we are going to create our first view. But before we create the view we need to add some tables to our database. Otherwise the Studio does not have any information on how to manage the view. Start by click "Create a table". Our first table is a product table with the following columns:
id - Numeric - 14,0
number - ASCII - 50,0
name - ASCII - 50,0
ean - ASCII - 20,0
(You can add what ever information you need here)
In order for the database to sort and search the columns we need to set up some indexes:
Index 1: id
Index 2: number, id
Index 3: name, id
Index 4: ean, id
I use the id here, but you could also use the Recnum. If I don't have a unique identifier at the end of the index I can not have two products with the same name. You could of course argue that you should not in this case. But I added them anyway just to show that this is the way to do it.
Now let's get to the view. Click "Create view" and select the "Web View Wizard" and click "OK" then "Next". In the form you just write oProduct in the name field and when you press tab the rest of the fields will be filled automatically, then click "Next". Here you get to choose between a simple form and a Header detail, we will cover the later in a future video so let's stick with the simple view. "Next".
Here is where the magic begins. You select the table you want as you Main DataDictionary on the view, in this case the product table and after you click "Next" you get a list of the columns you are able to add to your view. Just add "All". Now you can change the labels and select if the fields should be on the same line and even move some fields into tabs on the page. You also have the possibility to preview. Then you just click "Next" and "Finish" and you are done.
It is time to hit F5 and run the application. The username and password is Guest and you should be able to work with the view, add items, search and modify as well as delete them.
No it's your turn. Try to create a table of your own choice and play around with the wizard to design some cool views and then run them in your web browser.
- dataflex, simple view, software