4D v13Video script |
||
|
4D v13
Video script
Video script
In this video, we're going to learn how to enter and delete data using relations and their properties.
The XY ID does not actually exist. If we want to create a new code, for example this one:
This record appears above the Interventions record. When we close it, the Interventions record is shown again. Thanks to this automatic relation, and without any programming, we have just entered data in multiple tables with automatic integrity control. We can use this relation again to simplify data entry. Since we don't know all the record IDs for each table, we can just start entering an ID and then add the @ symbol to get a list of all the records that "start with" the same letters or numbers. We saw that among the imported technicians, there were several records beginning with "M" so we can just enter "m@" to see all the IDs the match. Next we'll see that it is possible to display the name of the technician concerned here. You can also enter just the @ symbol and all the IDs including the one just created will appear automatically. @ is the wildcard character which corresponds to the * in other tools so it can be used at the beginning, middle or end of a character string. We're going to modify the relation in the Structure so that we can see the last name of the technician concerned. By clicking on the relation, we can then choose the Last name as Wildcard Choice; the "Auto Wildcard support" box is automatically checked. Of course, these automatic entry modes can be completed by programmed functions. This will be covered in other videos later. Record deletion also depends on the configuration of the relation. In this case, it's the "One to Many" relation and, more specifically, the Deletion Control setting that is taken into account . If we take the NEY technician and try to delete it (by hitting backspace), 4D asks for confirmation. OK. Automatically, 4D check Interventions to see whether this technician actually exists and since we checked the "Cannot delete if related many" box, 4D refuses to delete this technician in order to preserve database integrity. The + here (at the bottom left of the error message) usually gives you additional information about the cause of the error. So, we have the first "Cannot delete" message like we see here and below we can see the reason why it is not possible to delete it. You can click on Continue. Normally, we haven't linked this technician with any interventions so we should be able to delete him and, so we see that he has been removed. Note that the deletions mentioned above also depend on the record access mode (read orwrite) and on any locking of the records by other users or other processes. This remains valid regardless of the way the records are deleted (whether by a user action or by programming). So by analyzing your database specifications, you can find out the best way to configure relations. Now, how can we use automatic relations to display the fields of the Technician record in the Intervention record and display the list of interventions in the Technician record. To do this, we're going to go back to an intervention and, at this level, we see that we only have the technician ID. We're going to add the description for the technician below.
In this form, we're going to:
Then
When we change records, the update is automatic; we still have not programmed this automatic feature. Of course, if the relation was not automatic, we could have managed all this using programming. Now let's see about the other thing we mentioned, which was displaying the list of interventions in the technician record. So we display the technician record, then go back to the Explorer where we're going to drag the output form directly onto the technician's record. Naturally, we don't actually need the technician's initials in this form but for the moment, the important thing is to understand how it works. So, we save this form as well. Now we're going to check that in the structure this relation is an automatic One to Many relation; then during use, automatically, the list of interventions changes depending on the technician whose record we're looking at. If we change the relation back to manual, when we go back to the technician's record, we see the same interventions displayed since the loading of the corresponding records (the join) was not performed automatically by 4D. In this case, it will be up to us to do it. Later we'll see how to manage these functions using programming, more specifically because automatic relations are enabled when there is a screen display for a user, but not in every case when we use programming, which means that we can take control and manage relations however we want. |
PROPERTIES
Product: 4D |