issue85:libreoffice_p_37
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue85:libreoffice_p_37 [2014/11/23 23:12] – d52fr | issue85:libreoffice_p_37 [2014/11/25 18:59] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
**In my article in issue 83 of Full Circle Magazine, I walked you through creating a form that used a view, but I left things unfinished in the forms: I didn't do anything to format the controls to ensure data integrity. If you haven' | **In my article in issue 83 of Full Circle Magazine, I walked you through creating a form that used a view, but I left things unfinished in the forms: I didn't do anything to format the controls to ensure data integrity. If you haven' | ||
- | Dans mon article du numéro 83 de FCM, je vous ai monté | + | Dans mon article du numéro 83 du FCM, je vous ai montré |
**Date and Time Controls | **Date and Time Controls | ||
Ligne 10: | Ligne 10: | ||
Contrôles de date et d' | Contrôles de date et d' | ||
- | Maintenant reprenons le travail. Dans le volet « Formulaires | + | |
- | Double-cliquez sur le contrôle de date pour la boîte de dialogue des propriétés. Dans l' | + | Maintenant reprenons le travail. Dans le volet « Formulaires |
+ | |||
+ | Double-cliquez sur le contrôle de date pour afficher | ||
**Date Min / Date Max – These two options allow you to control the minimum and maximum date values allowed in the fields. These fields have default values of 01/01/1800 for minimum and 12/31/2200 for maximum. In general applications, | **Date Min / Date Max – These two options allow you to control the minimum and maximum date values allowed in the fields. These fields have default values of 01/01/1800 for minimum and 12/31/2200 for maximum. In general applications, | ||
Ligne 17: | Ligne 19: | ||
Date Format – There are 12 different date formats. This option determines how the control will display the date. Scroll through the options and see which one best suits your application.** | Date Format – There are 12 different date formats. This option determines how the control will display the date. Scroll through the options and see which one best suits your application.** | ||
- | Date Min / Date Max - Ces 2 options vous permettent de contrôler les valeurs de dates mini et maxi autorisées dans les champs. Les valeurs par défaut sont le 01/01/1980 pour la minimum et 12/31/2200 pour le maximum. Dans les applications habituelles, | + | Date Min/Date Max - Ces deux options vous permettent de contrôler les valeurs de dates mini et maxi autorisées dans les champs. Les valeurs par défaut sont le 01/01/1980 pour le minimum et le 12/31/2200 pour le maximum. Dans les applications habituelles, |
- | Format de Date - Il y a 12 formats différents de date. Cette option détermine le format d' | + | Format de Date - Il y a 12 formats différents de date. Cette option détermine le format d' |
**Default Date – This is a default value for the field. If you have a date that users should use most of the time, then use that date. It will speed up data entry. It can also show the user the format in which to enter dates. Unfortunately, | **Default Date – This is a default value for the field. If you have a date that users should use most of the time, then use that date. It will speed up data entry. It can also show the user the format in which to enter dates. Unfortunately, | ||
Ligne 25: | Ligne 27: | ||
Spin Button – Setting this option to Yes will put an up-and-down spin button on the control. The user can use this button to adjust the month, day, and year. The user clicks into the part of the date they want to adjust and makes changes by clicking on these buttons. Very handy for data entry.** | Spin Button – Setting this option to Yes will put an up-and-down spin button on the control. The user can use this button to adjust the month, day, and year. The user clicks into the part of the date they want to adjust and makes changes by clicking on these buttons. Very handy for data entry.** | ||
- | Date par défaut- Il y a une date par défaut pour ce champ. S'il y a une date que les utilisateurs choisiront la plupart du temps, alors utilisez cette date. Çà accélérera la saisie. | + | Date par défaut- Il y a une date par défaut pour ce champ. S'il y a une date que les utilisateurs choisiront la plupart du temps, alors utilisez cette date. Ça accélérera la saisie. |
- | Compteur - Mettre cette option à Oui ajoute un bouton « Monte-Baisse » au contrôle. L' | + | Compteur - Mettre cette option à Oui ajoute un bouton « Monte-Baisse » au contrôle. L' |
**Repeat – The Repeat option is related to the spin button option. It controls whether to repeat when you hold down the mouse button on the spin button. Use at your own discretion. Sometimes, it makes sense. Other times, not so much. | **Repeat – The Repeat option is related to the spin button option. It controls whether to repeat when you hold down the mouse button on the spin button. Use at your own discretion. Sometimes, it makes sense. Other times, not so much. | ||
Ligne 33: | Ligne 35: | ||
Delay – The Delay option controls the speed of the repeat option. A longer delay means you have to hold the button down longer before it will repeat. The default is “50 ms” (milliseconds).** | Delay – The Delay option controls the speed of the repeat option. A longer delay means you have to hold the button down longer before it will repeat. The default is “50 ms” (milliseconds).** | ||
- | Répéter - L' | + | Répéter - L' |
- | Délai - L' | + | Délai - L' |
**Dropdown – Dropdown adds a listbox style arrow to the control. Clicking it displays a calendar where you can select the date you need. | **Dropdown – Dropdown adds a listbox style arrow to the control. Clicking it displays a calendar where you can select the date you need. | ||
Ligne 43: | Ligne 45: | ||
After you make your adjustments to the control, save the form and close it. Open the form and test your newly adjusted date control. Feel free to experiment with the different control options to get a better idea of how they work. The options for a time control are the same as the date control except you don't have the Dropdown option.** | After you make your adjustments to the control, save the form and close it. Open the form and test your newly adjusted date control. Feel free to experiment with the different control options to get a better idea of how they work. The options for a time control are the same as the date control except you don't have the Dropdown option.** | ||
- | Déroulante - l' | + | Déroulante - l' |
NOTE : Vous pouvez utiliser les options Compteur et Déroulante ensemble pour créer un contrôle flexible. | NOTE : Vous pouvez utiliser les options Compteur et Déroulante ensemble pour créer un contrôle flexible. | ||
Ligne 55: | Ligne 57: | ||
Rendre le titre obligatoire | Rendre le titre obligatoire | ||
- | Maintenant que nous avons réglé le contrôle de date, attaquons-nous à quelques possibles difficultés avec la zone de saisie du champ Title. Quand nous avons créé | + | Maintenant que nous avons réglé le contrôle de date, attaquons-nous à quelques possibles difficultés avec la zone de saisie du champ « Title ». Quand nous avons créé |
**Open “ProjectForm” for editing. Right-clicking the “Title” label or input box, Group > Ungroup. Now, double-click the “Title” input box to bring up its properties dialog. On the “General” tab, set the value for “Max Length” to 50. This will prevent the user from entering more than 50 characters. On the “Data” tab, make sure that both “Empty String Is NULL” and “Input Required” are set to “Yes.” These two settings become a redundancy check for making sure there is a valid value in the input field.** | **Open “ProjectForm” for editing. Right-clicking the “Title” label or input box, Group > Ungroup. Now, double-click the “Title” input box to bring up its properties dialog. On the “General” tab, set the value for “Max Length” to 50. This will prevent the user from entering more than 50 characters. On the “Data” tab, make sure that both “Empty String Is NULL” and “Input Required” are set to “Yes.” These two settings become a redundancy check for making sure there is a valid value in the input field.** | ||
- | Ouvrez « ProjectForm » en édition. Faites un clic droit sur l' | + | Ouvrez « ProjectForm » en édition. Faites un clic droit sur l' |
**However, we still have an issue with the fact that the user can just create a “Title” with spaces. To fix this issue, we will need to use a little SQL. I have looked for a graphical way to get the same result, but sometimes, when you work with databases, SQL is the best, if not only, choice. We will add a CHECK constraint to the “Project” table. Click on Tools > SQL. To enter the SQL, Tools > SQL... Use the following SQL command to add the constraint to the table:** | **However, we still have an issue with the fact that the user can just create a “Title” with spaces. To fix this issue, we will need to use a little SQL. I have looked for a graphical way to get the same result, but sometimes, when you work with databases, SQL is the best, if not only, choice. We will add a CHECK constraint to the “Project” table. Click on Tools > SQL. To enter the SQL, Tools > SQL... Use the following SQL command to add the constraint to the table:** | ||
- | Cependant, nous avons toujours un problème avec le fait que l' | + | Cependant, nous avons toujours un problème avec le fait que l' |
ALTER TABLE “Project” | ALTER TABLE “Project” | ||
Ligne 73: | Ligne 75: | ||
**The ALTER TABLE command means we are making changes to the table, in this case the table “Project.” To indicate the change we are making, we use the ADD CONSTRAINT command. NOSPACES_CK is the name of the constraint we are adding. It's not required that you make your constraint names all caps. I just do it as a matter of convention. The last line is the CHECK constraint. Using the built-in function TRIM, it removes all the spaces from both sides of the string and checks to make sure it is not equal to an empty string. Now, if someone tries to use a string of spaces for the “Title”, | **The ALTER TABLE command means we are making changes to the table, in this case the table “Project.” To indicate the change we are making, we use the ADD CONSTRAINT command. NOSPACES_CK is the name of the constraint we are adding. It's not required that you make your constraint names all caps. I just do it as a matter of convention. The last line is the CHECK constraint. Using the built-in function TRIM, it removes all the spaces from both sides of the string and checks to make sure it is not equal to an empty string. Now, if someone tries to use a string of spaces for the “Title”, | ||
- | La commande ALTER TABLE signifie que nous apportons des changements à la table, en l’occurrence la table « Project ». Pour indiquer le changement à faire, nous utilisons la commande ADD CONSTRAINT. NOSPACES_CK est le nom de la contrainte à ajouter. | + | La commande ALTER TABLE signifie que nous apportons des changements à la table, en l’occurrence la table « Project ». Pour indiquer le changement à faire, nous utilisons la commande ADD CONSTRAINT. NOSPACES_CK est le nom de la contrainte à ajouter. |
**You can do the same thing for the “FirstName” and “LastName” fields in the “TeamMember” table. The “Max Length” for the name fields is 25. I suggest the following SQL for adding the constraints: | **You can do the same thing for the “FirstName” and “LastName” fields in the “TeamMember” table. The “Max Length” for the name fields is 25. I suggest the following SQL for adding the constraints: | ||
Ligne 98: | Ligne 100: | ||
The view we create for putting the names in the drop down list box in the “ProjectForm” is good, legal SQL, but there are a couple of problems. First, although we have prevented a name from being just spaces, the users can still add a legal name with spaces added to the beginning or end. Also, the names are not in any order.** | The view we create for putting the names in the drop down list box in the “ProjectForm” is good, legal SQL, but there are a couple of problems. First, although we have prevented a name from being just spaces, the users can still add a legal name with spaces added to the beginning or end. Also, the names are not in any order.** | ||
- | Améliorer | + | Améliorer |
- | La vue que nous avons créé | + | La vue que nous avons créée pour mettre les noms sous forme de liste déroulante dans « ProjectForm » est en bon et légal SQL mais il y a deux problèmes. D' |
**Luckily, we can edit our view and make some additions to address these problems. Select “Tables” from the “Database” pane. Right-click “TeamView” and select “Edit in SQL View...” This brings up the SQL we used to create the view. Change the current SQL so it looks like the following: | **Luckily, we can edit our view and make some additions to address these problems. Select “Tables” from the “Database” pane. Right-click “TeamView” and select “Edit in SQL View...” This brings up the SQL we used to create the view. Change the current SQL so it looks like the following: | ||
+ | |||
+ | Heureusement, | ||
SELECT TRIM(BOTH FROM “FirstName”) || ' ' | SELECT TRIM(BOTH FROM “FirstName”) || ' ' | ||
Ligne 109: | Ligne 113: | ||
**We already saw TRIM when we created our CHECK constraints. It removes all spaces from the beginning and end of ”FirstName” and “LastName”.** | **We already saw TRIM when we created our CHECK constraints. It removes all spaces from the beginning and end of ”FirstName” and “LastName”.** | ||
+ | |||
+ | Nous avons déjà vu TRIM quand nous avons créé les contraintes CHECK. Il enlève les espaces au début et à la fin de « FirstName » et de « LastName ». | ||
**At the end, we tag on an ORDER BY command to sort the names by “LastName”, | **At the end, we tag on an ORDER BY command to sort the names by “LastName”, | ||
Ligne 116: | Ligne 122: | ||
W3Schools SQL Tutorial http:// | W3Schools SQL Tutorial http:// | ||
+ | |||
+ | A la fin, nous ajoutons la commande ORDER BY pour classer les noms par « LastName », puis par « FirstName ». Cela signifie que les noms seront d' | ||
+ | Avec les réglages des contrôles et un peu de SQL, nous avons été capables d' | ||
+ | Sur mon blog « What the tech am I doing ? » (Ndt : Quelle technique j' | ||
+ | |||
+ | W3Schools SQL Tutorial (Ndt : Tutoriel SQL des écoles W3) http:// |
issue85/libreoffice_p_37.1416780763.txt.gz · Dernière modification : 2014/11/23 23:12 de d52fr