4D v14

Video script

Home

 
4D v14
Video script

Video script  


 

 

In the first few videos, we used standard editors to perform queries and sorts. In this video, we're going to learn how to program the display of these standard editors.

At the top of the form, we have a series of buttons that you have integrated. In the previous chapter, we started to program the "All" button for the Technicians table.

Now we're going to program them to take into account the list displayed on the screen when the click occurs, and thus the current page.

Let's start with the "All" button:

  • Display the Navigation form.
  • Select the "All" button (on page 0).
  • Display the associated object method (Right click -> Object Method) or ALT+Click to open this method.

We have to use the ALL RECORDS command which takes the name of the table concerned as a parameter.

But how can we know which table is displayed when the click occurs?

We know that we put the list of Interventions on page 1 of the form, the list of Technicians on page 2, and so on.

We just need to have 4D indicate which page is displayed and then perform the query on this page.
At first, we need to write it as follows:

 Case of
    :(FORM Get current page=1)
       ALL RECORDS([INTERVENTIONS])
    :(FORM Get current page=2)
       ALL RECORDS([TECHNICIANS])
 End case

This way we indicate to 4D that if the current page is page 1, it should select the list of interventions and if it's page 2, then it should select the list of technicians.

When we are on the Interventions page, we now get all the interventions and on the technicians page, we get all the technicians.

Now we're going to do the same with the "Query" button.

  • Display page 0 of the Navigation form
  • ALT+click on the "All" button to Copy the method then close it
  • ALT+click on the "Query" button to create its method
  • Paste
  • and we're going to replace ALL RECORDS with QUERY

Then we close the method.

We re-execute the form "Run" => "Navigation" method
and now when we are on "Interventions":

  • If we click on Query, we now have the fields of the Interventions table
  • If we are on Technicians, Query gives us fields from the Technicians table

Refer to the previous videos and to the documentation to find out more about how this editor works.

For the moment, we're not going to program the other buttons on the template that we just used because later on we're going to make this programming generic.

 
PROPERTIES 

Product: 4D
Theme: Queries and sorts

 
ARTICLE USAGE

Self-training ( 4D v13)
Self-training ( 4D v14)