データ

データ タブページでは、フォームの関連データベースを参照するフォーム属性を指定します。

フォームの基になるデータソースを指定できるほか、ユーザーによるデータの編集を許容するかどうかを設定可能です。並べ替え機能とフィルター機能に加えて、サブフォームを作成するために必要なすべての属性が提示されます。

このコマンドの見つけ方

Open context menu of a selected form element - choose Form Properties - Data tab.

Open Form Design toolbar, click Form Properties icon - Data tab.


SQLコマンドの解析

Specifies whether the SQL statement is to be analyzed by LibreOffice. If set to Yes, you can click the ... button next to the Content list box. This will open a window where you can graphically create a database query. When you close that window, the SQL statement for the created query will be inserted in the Content list box.

コンテンツ

Determines the content to be used for the form. The content can be an existing table or a query (previously created in the database), or it can be defined by an SQL-statement. Before you enter a content you have to define the exact type in Content type.

内容の種類 で「テーブル」または「クエリー」のいずれかを選択すると、このボックスには、選択したデータベース内で設定されているすべてのテーブルとクエリーの全リストが表示されます。

サイクル

Determines how the navigation should be done using the tab key. Using the tab key, you can move forward in the form. If you simultaneously press the Shift key, the navigation will follow the opposite direction. If you reach the last (or the first) field and press the tab key again, it can have various effects. Define the key control with the following options:

オプション

意味

標準

このように設定すると、既存のデータベースリンクにアクセスするサイクルが自動的に定義されます。フォーム内にデータベースリンクが存在する場合、タブキーで最後のフィールドを終了すると、次あるいは前のレコードに移動します (「すべてのレコード」参照)。データベースリンクがない場合、次あるいは前のフォームに移動します(現在のページ参照)。

すべてのレコード

このオプションはデータベースフォームのみに適用されます。すべてのレコードをナビゲートする場合に、このオプションを使用します。フォームの最後のフィールドで Tab キーを使って移動すると、現在のレコードが変更されます。

現在のレコード

このオプションはデータベースフォームのみに適用されます。現在のレコード内をナビゲートする場合に、このオプションを使用します。フォームの最後のフィールドで Tab キーを使って移動すると、現在のレコードが変更されます。

現在のページ

フォームの最後のフィールドからTab キーを使って移動すると、カーソルが次のフォームの最初のフィールドに移動します。これは、HTML フォームの標準動作です。したがって、このオプションは特に、HTML フォームでの使用が想定されています。


データだけを追加

Determines if the form only allows the addition of new data (Yes) or if it allows other properties as well (No).

note

データのみ追加 を「はい」に設定した場合、データの変更または削除が不可能になります。


データの削除

Determines if the data can be deleted.

データの変更

Determines if the data can be modified.

データの追加

Determines if data can be added.

データソース

Defines the data source to which the form should refer. If you click the ... button, you call the Open dialog, where you can choose a data source.

データソースの種類

データソースとして既存のデータベーステーブルかクエリーを使用するか、あるいはSQLステートメントに基づいてフォームを作成するかを選択します。

「テーブル」あるいは「クエリー」を選択すると、フォームは、内容 で指定するテーブルまたはクエリーを参照します。新しいクエリーまたはサブフォームを作成する場合は、「SQL」オプションを選択する必要があります。SQLクエリーの文またはサブフォームは、コントロール属性のデータタブページの リストの内容 ボックスに直接入力できます。

ナビゲーションバー

Specifies whether the navigation functions in the lower form bar can be used.

「親フォーム」オプションはサブフォームに使用します。 このオプションをサブフォームで選択した場合、カーソルがサブフォーム内にあるときにはメインフォームのレコードを使ってナビゲートできます。 サブフォームは 1 対 1 の関係で親フォームにリンクされているので、ナビゲーションは常に親フォームで行われます。

フィルター

Enter the required conditions for filtering the data in the form. The filter specifications follow SQL rules without using the WHERE clause. For example, if you want to display all records with the "Mike" forename, type into the data field: Forename = 'Mike'. You can also combine conditions: Forename = 'Mike' OR Forename = 'Peter'. All records matching either of these two conditions will be displayed.

フィルター機能は、ユーザーモードで フォームナビゲーション バーオートフィルター アイコンと デフォルトフィルター アイコンから使用できます。

リンク元

If you create a subform, enter the data field of the parent form responsible for the synchronization between parent and subform. To enter multiple values, press Shift + Enter after each input line.

The subform is based on an SQL query; more specifically, on a Parameter Query. If a field name is entered in the Link master fields box, the data contained in that field in the main form is read to a variable that you must enter in Link slave fields. In an appropriate SQL statement, this variable is compared to the table data that the subform refers to. Alternatively, you can enter the column name in the Link master fields box.

その際、以下の例を参考にしてください。

フォームがベースとするデータベーステーブルが、たとえば、各顧客を一意的な番号で表示した、すなわちデータフィールド「顧客_ID」を有する顧客データベース(「顧客」)であるとします。1人の顧客の注文は、他のデータベーステーブルで管理しています。このフォームに入力する各顧客に関して、その注文も表示するには、サブフォームを作成し、リンク元 に、顧客を一意的に識別できる顧客データベースのデータフィールド、すなわち「顧客ID」を入力します(カギかっこは入力しません)。リンク先 に、顧客ID フィールドのデータを取り込む変数の名前、たとえば、「x」を入力します。

サブフォームには、各顧客 ID(Customer_ID -> x) に該当する適切なデータが注文テーブル ("Orders") から表示されるはずです。この動作が可能なのは、注文テーブル内で各注文が単一の顧客に一意に割り当てられている場合に限られます。また、別のフィールド Customer_ID を使用することもできます。ただし、このフィールドとメインフォームの同じフィールドを混同しないように、このフィールドには Customer_Number という名前が付けられています。

例えば、次のSQLステートメントでx変数を使用して、「Orders」テーブルの Customer_Number を「Customers」テーブルのCustomer_IDと比較できます。

SELECT * FROM Orders WHERE Cust_No =:x (サブフォームに Orders テーブルのすべてのデータを表示させる場合)

あるいは、

SELECT Item FROM Orders WHERE Cust_ID =:x (テーブル Orders のサブフォームにフィールド Item のデータだけを表示する場合)

SQLステートメントは、データソース で入力するか、あるいはサブフォームを作成するパラメータークエリーを作成します。

リンク先

If you create a subform, enter the variable where possible values from the parent form field can be stored. If a subform is based on a query, enter the variable that you defined in the query. If you create a form using an SQL statement entered in the Data source field, enter the variable you used in the statement. You can choose any variable name. If you want to enter multiple values, press Shift + Enter.

リンク元 で、上位フィールドとして、たとえば、データベースフィールド「顧客 ID」を入力した場合、リンク先 で、データベースフィールド「顧客 ID」の値を読み出す変数名を指定します。この変数を使って、データソース ボックスに SQLステートメントを入力する場合、当該値がサブフォームに表示されます。

並べ替え

Specifies the conditions to sort the data in the form. The specification of the sorting conditions follows SQL rules without the use of the ORDER BY clause. For example, if you want all records of a database to be sorted in one field in an ascending order and in another field in a descending order, enter Forename ASC, Name DESC (presuming Forename and Name are the names of the data fields).

ユーザーモードでは、フォームナビゲーション バーの該当するアイコン、昇順のソート降順のソートソート を使ってソートを行うことができます。

サブフォームとは何か。

フォームは、データベーステーブルあるいはデータベースクエリーを基に作成されます。データを表示できるようにすれば、新しいデータを入力したり、フォームを基にしたデータベーステーブルあるいはデータベースクエリーに保存されている既存のデータを変更するのに役立ちます。

If you require a form that can refer to the data in a table or query and can additionally display data from another table, you should create a subform. For example, this subform can be a text box that displays the data of another database table.

サブフォームは、メインフォームの「追加コンポーネント」に他なりません。このメインフォームを、「上位フォーム」または「マスター」と呼んでいます。1 つのフォームで 2 つ以上のテーブルにアクセスする場合に、サブフォームが必要になります。その他の各テーブルにも、それぞれ 1 つのサブフォームが必要です。

フォームの作成後に、フォームをサブフォームに変更できます。変更するには、デザインモードに入り、「フォームナビゲーター」を開きます。「フォームナビゲーター」で、(サブフォームに変更する) フォームを (マスターフォームにする) 別のフォーム上にドラッグします。

ドキュメントのユーザーからは、フォームにサブフォームがあることはわかりません。ユーザーからは、データが入力されているドキュメント、または既存のデータが表示されているドキュメントのみ見えます。

マスターフォーム内のデータフィールドのリンク元を指定します。サブフォームでは、リンク元の内容に対応するフィールドとして、リンク先を設定できます。

ユーザーがデータをナビゲートするとき、フォームには常に現在のデータレコードが表示されます。サブフォームが定義されている場合、サブフォームの内容は約 200 ミリ秒の短い遅延をおいて表示されます。このような遅延により、マスターフォームのデータレコードを素早く参照することができます。遅延の制限内に次のマスターデータレコードにナビゲートすれば、サブフォームのデータを取得、表示する必要がなくなります。

ご支援をお願いします!