データ

The Data tab page allows you to assign a data source to the selected control.

このコマンドの見つけ方

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

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


note

For forms with database links, the associated database is defined in the Form Properties. You will find the functions for this on the Data tab page.


The possible settings of the Data tab page of a control depend on the respective control. You will only see the options that are available for the current control and context.
The following fields are available:

ソースセル範囲

Enter a cell range that contains the entries for a list box or combo box on a spreadsheet. If you enter a multi-column range, only the contents of the leftmost column are used to fill the control.

データフィールド

With database forms, you can link controls with the data fields.

ここでは、考慮すべきケースがいくつかあります。

  1. 最初のケース:フォーム内にテーブルがひとつだけ存在する場合。

    データフィールド属性には、フィールド内容を表示するデータソーステーブルのフィールドを指定します。

  2. 第2のケース: SQLクエリーによって作成されるサブフォームにコントロールが属します。

    データフィールド属性には、フィールド内容を表示する SQLステートメントのフィールドを指定します。

  1. 第3のケース: コンボボックス

    コンボボックスの場合、データフィールド で、ユーザーが入力あるいは選択した値を保存する現在のフォームテーブルのフィールドを入力します。(リストの内容 で入力する SQLステートメントにより、このコンボボックスに表示される値を指定します。)

  2. 第4のケース: リストボックス

    データソーステーブルが表示するデータを持つのではなく、共通データフィールド経由でデータソーステーブルにリンクされたテーブルである場合。

    たとえば、現在のデータソーステーブルにリンクしたテーブルからデータを読み込んで、それをリストボックスに表示させる場合、データフィールド には、このリストボックスに参照させるデータソーステーブルのフィールドを指定します。あるいは、フォーム中でのデータ表示を制御させるデータベースフィールドを指定します。この場合は、2つのテーブルを共通のデータフィールドでリンクできるものとして、他方のテーブルへのリンクを、このデータフィールドで中継させます。通常、こうしたリンク用のデータフィールドには、一意的に決まる識別番号を収めたデータフィールドを使用するのが普通です。フォームに表示するデータフィールドは、リストの内容 のSQLステートメントで指定します。

リストボックスを、参照によって動作させます。SQLステートメント(第4例)を介してリンクしているテーブルを使って、あるいは値のリストを介してリストボックスを動作させることができます。

リンクしているテーブル(SQLステートメント)による参照

リストボックスに表示させるデータを、フォームで利用するテーブルに共通データフィールドでリンクさせたデータベーステーブルから取り出す場合、フォームテーブルのリンクフィールドを データフィールド で指定します。

リストの内容の種類 で「sql」か「sql [Native]」を選択した場合、このリンクは リストの内容 フィールドに表示されるSQLステートメントのSelect句で処理されます。たとえば、フォームコントロールにリンクした「Order」テーブルがあり、データベース中ではこの「Order」テーブルに対して「Customers」テーブルがリンクしているという状況を想定します。この場合のSQLステートメントは下記のように記述できます。

SELECT CustomerName, CustomorNo FROM Customers,

ここで「CustomerName」はリンク先の「Customers」テーブル中のデータフィールドであり、「CustomerNo」も「Customers」テーブル中のデータフィールドですが、こちらは データフィールド にフォームテーブルとして指定した「Orders」テーブル中のフィールドにリンクしてあるものです。

値のリストを介する参照

リストボックスの場合、値のリストを使うことができます。これは、参照値を定義するリストです。これにより、フォーム内のコントロールに直接、データベースフィールドの内容が表示されるのではなく、値のリストに割り当てられた値を介して表示されます。

値リストの参照値を操作することで、フォームの データフィールド に指定したデータフィールドの内容を表示することなく、割り当てた値が表示されるようになります。データ タブの リスト内容の種類 で「値リスト」を選択し、フォーム上の表示リストの項目への参照値を、リストの項目 (全般 タブで入力) に指定すると、この参照値と指定データフィールドの内容とが比較されます。参照値に一致するデータフィールドの内容が存在すると、対応するリストの項目がフォームに表示されます。

フィルター候補

While designing your form, you can set the "Filter proposal" property for each text box in the Data tab of the corresponding Properties dialog. In subsequent searches in the filter mode, you can select from all information contained in these fields. The field content can then be selected using the AutoComplete function. Note, however, that this function requires a greater amount of memory space and time, especially when used in large databases and should therefore be used sparingly.

リストの内容

With database forms, specifies the data source for the list content of the form-element. This field can be used to define a value list for documents without a database connection.

データベースフォームの場合、リストボックスおよびコンボボックスの表示項目は、データソースにより決まります。選択した種類に応じて、データベース中にいくつかのオブジェクトがある場合、リストの内容 には指定可能な複数のデータソースが表示されますここには、リストの内容の種類 で選択した種類に該当する、すべてのデータベースオブジェクトが一覧表示されます。リストの内容の種類として「値リスト」を選択した場合は、データベースフォームへの参照値を使用できます。またコントロールの表示内容を SQLコマンドで制御する場合は、ここには SQLステートメントを入力します。

SQLステートメントの例

リストボックスの場合、SQLステートメントは次の形式になります。

SELECT feld1, feld2 FROM tabelle,

ここで、「tabelle」は、コントロールのリストに表示されるデータの入ったテーブルのことです (リストテーブル)。「feld1」は、フォームの表示項目を指定するデータフィールドで、その内容がリストボックスに表示されます。リンクするフィールド で =1を選択した場合には、「feld2」は、データフィールド で入力したフィールドを介して、フォームテーブル(値のテーブル)とリンクするリストテーブルのフィールドです。

コンボボックスの場合、SQLステートメントは次の形式になります。

SELECT DISTINCT feld FROM tabelle,

ここでの「field」の意味は、コンボボックスのリストに表示されるリストテーブル「table」にあるデータフィールドの 1 つを示します。

HTMLドキュメントの場合の値のリスト

HTML フォームの場合は、リストの内容 に値リストを入力できます。リストの内容の種類 で「値リスト」を選択します。ここに入力する値は、フォーム上に表示するものではなく、表示項目へ値を指定するために使用します。リストの内容 に指定する項目は、HTML タグの <OPTION VALUE=...> に相当するものです。

リストボックスやコンボボックスの選択項目をデータ転送する際には、フォームに表示される値のリストで 全般 タブの リストの項目 に入力されたものと、データ タブの リストの内容 に入力された値リストの両方が対象とされます。そして、値リスト (<OPTION VALUE=...>) の選択位置に空白でないテキストがあれば、それが送信されます。それ以外の場合は、(<OPTION>) コントロールの表示テキストが送信されます。

値リストに空白の文字列を指定するには、リストの内容 の該当箇所に「$$$empty$$$」と入力します (大文字/小文字に注意します)。この文字列は LibreOffice により空白文字列と解釈され、リスト項目の中に登録されます。

HTML、JavaScript、 LibreOffice フィールド リストの内容 の間の関係をリストボックス名「ListBox1」を使って、以下の表に示します。この場合の「Item」は、フォームに表示されているリスト項目です。

HTMLタグ

JavaScript

コントロールの値のリストの項目(リストの内容)

転送されるのは...

<OPTION>Item

不可能

""

...表示されているリスト項目(「ListBox1=Item」)。

<OPTION VALUE="Wert">Item

ListBox1.options[0].value="Wert"

「値」

...リスト項目に割り当てられている値(「ListBox1=Wert」)。

<OPTION VALUE="Wert">Item

ListBox1.options[0].value=""

「$$$empty$$$」

...スペース(「ListBox1=」)。


リストの内容の種類

Determines the data to fill the lists in list and combo boxes.

「値リスト」オプションを選択すると、全般 タブ の リストの項目 フィールドに入力したすべての項目が、コントロールに表示されます。データベースフォームに関しては、参照値を使用できます (詳細は 値のリストを介する参照 の節を参照してください)。

コントロールの内容をデータベースから読み込む場合、他のオプションでデータソースの種類を指定できます。たとえばここでは、テーブルとするかクエリーとするかを選択できます。

リンクされたセル

Specifies the reference to a linked cell on a spreadsheet. The live state or contents of the control are linked to the cell contents. The following tables list the controls and their corresponding link type:

リンクされたセルのあるチェックボックス

アクション

結果

Select the check box:

TRUE is entered into the linked cell.

Deselect the check box:

FALSE is entered into the linked cell.

Tri-state check box is set to "undetermined" state:

#NV is entered into the linked cell.

Enter a number or a formula that returns a number in the linked cell:

If entered value is TRUE or not 0: Check box is selected.
If entered value is FALSE or 0: Check box is deselected.

Clear the linked cell, or enter text, or enter a formula that returns text or an error:

チェックボックスが 3 種類の条件付きチェックボックスの場合には、「不確定」状態に設定されます。上記以外のチェックボックスの場合には、オフになります。

Select the box. The Reference value box contains text:

The text from the Reference value box is copied to the cell.

Deselect the box. The Reference value box contains text:

空の文字列がセルにコピーされます。

The Reference value box contains text. Enter the same text into the cell:

チェックボックスがオンです。

The Reference value box contains text. Enter another text into the cell:

チェックボックスがオフです。


リンクされたセルのあるオプションボタン (ラジオボタン)

アクション

結果

Select the option button:

TRUE is entered into the linked cell.

Option button is deselected by selecting another option button:

FALSE is entered into the linked cell.

Enter a number or a formula that returns a number in the linked cell:

If entered value is TRUE or not 0: Option button is selected.
If entered value is FALSE or 0: Option button is deselected.

Clear the linked cell, or enter text, or enter a formula that returns text or an error:

Option button is deselected.

Click the option button. The Reference value box contains text:

The text from the Reference value box is copied to the cell.

Click another option button of the same group. The Reference value box contains text:

空の文字列がセルにコピーされます。

The Reference value box contains text. Enter the same text into the cell:

オプションボタンがオンです。

The Reference value box contains text. Enter another text into the cell:

オプションボタンがクリアされます。


リンクされたセルのあるテキストボックス

アクション

結果

Enter text into the text box:

Text is copied into the linked cell.

Clear the text box:

Linked cell is cleared.

Enter text or a number in the linked cell:

Text or number is copied into the text box.

Enter a formula into the linked cell:

Formula result is copied into the text box.

Clear the linked cell:

Text box is cleared.


リンクされたセルのある数値フィールドおよび書式付きフィールド

アクション

結果

Enter a number into the field:

Number is copied into the linked cell.

Clear the field:

Value 0 is set in the linked cell.

Enter a number or a formula that returns a number in the linked cell:

Number is copied into the field.

Clear the linked cell, or enter text, or enter a formula that returns text or an error:

Value 0 is set in the field.


リンクされたセルのあるリストボックス

リストボックスでは、2 種類のリンクモードがサポートされています。「リンクされたセルの内容」プロパティを参照してください。

  1. Linked contents: Synchronize the text contents of the selected list box entry with the cell contents.

  2. Linked selection position: The position of the single selected item in the list box is synchronized with the numerical value in the cell.

アクション

結果

Select a single list item:

「内容をリンク」では、項目のテキストがリンクされたセルにコピーされます。

Selection is linked: Position of the selected item is copied into the linked cell.
For example, if the third item is selected, the number 3 will be copied.

Select several list items:

#NV is entered into the linked cell.

Deselect all list items:

Contents are linked: Linked cell is cleared.

Selection is linked: Value 0 is entered in the linked cell.

Enter text or a number into the linked cell:

Contents are linked: Find and select an equal list item.

Selection is linked: The list item at the specified position (starting with 1 for the first item) is selected. If not found, all items are deselected.

Enter a formula into the linked cell:

Find and select a list item that matches the formula result and link mode.

Clear the linked cell:

Deselect all items in the list box.

Change the contents of the list source range:

変更に応じて、リストボックスの項目が更新されます。選択状態は保たれます。この結果リンクされたセルが更新される場合があります。


リンクされたセルのあるコンボボックス

アクション

結果

Enter text into the edit field of the combo box, or select an entry from the drop-down list:

Text is copied into the linked cell.

Clear the edit field of the combo box:

Linked cell is cleared.

Enter text or a number into the linked cell:

Text or number is copied into the edit field of the combo box.

Enter a formula into the linked cell:

Formula result is copied into the edit field of the combo box.

Clear the linked cell:

Edit field of the combo box is cleared.

Change the contents of the list source range:

変更に応じて、ドロップダウンリストの項目が更新されます。コンボボックスの編集フィールドおよびリンクされたセルは変更されません。


リンクされたセルの内容

Select the mode of linking a list box with a linked cell on a spreadsheet.

  1. Linked contents: Synchronize the text contents of the selected list box entry with the cell contents. Select "The selected entry".

  2. Linked selection position: The position of the single selected item in the list box is synchronized with the numerical value in the cell. Select "Position of the selected entry".

参照値 (オフ)

Check boxes and radio buttons in spreadsheets can be bound to cells in the current document. If the control is enabled, the value you enter in Reference value (on) is copied to the cell. If the control is disabled, the value from Reference value (off) is copied to the cell.

参照値 (オン)

You can assign a reference value to option buttons and check boxes. The reference value will be remitted to a server when sending the web form. With database forms the value entered here will be written in the database assigned to the control field.

Web フォームからの参照値

Web フォームをデザインし、コントロールのステータスに関する情報をサーバーに転送する場合に、参照値が有効です。 ユーザーがコントロールをクリックすると、それに対応する参照値がサーバーに送信されます。

例えば、オプション「女性」、「男性」に対応する 2 つのコントロールフィールドがあり、参照値 1 をフィールド「女性」、参照値 2 をフィールド「男性」に割り当てます。ユーザーがフィールド「女性」をクリックすると値 1 がサーバーに送信され、フィールド「男性」をクリックすると値 2 が送信されます。

データベースフォームの場合の参照値

データベースフォームの場合、オプションフィールドあるいはチェックボックスのステータスを同様に参照値で識別し、この参照値をデータベースに保存できます。たとえば、3つのオプション「作業中」、「処理済み」および「再提出」をグループ化し、それぞれに、参照「ToDo」、「OK」および「WV」を割り当てている場合、それぞれのオプションをクリックすると、データベースのこれらの参照値が表示されます。

空の文字列は NULL とみなす

Defines how an empty string input should be handled. If set to "Yes", an input string of length zero will be treated as a value NULL. If set to "No", any input will be treated as-is without any conversion.

An empty string is a string of length zero (""). Normally, a value NULL is not the same as an empty string. In general, a term NULL is used to denote an undefined value, an unknown value, or "no value has been entered yet."

データベースシステムはそれぞれ異なります。それぞれが、NULL 値を別々に扱っています。お使いのデータベースシステムのドキュメントを参照してください。

関連あるフィールド

note

プロパティブラウザー内の 境界フィールド セルの内容を削除すると、データの表示と交換用に結果セットの最初のフィールドが使用されます。


リストボックスに使える属性により、リンクしているテーブルのどのデータフィールドをフォームに表示するかが決まります。

フォーム内のリストボックスに、フォームテーブルとリンクしているテーブルの内容を表示するには、リストの内容の種類 フィールドで、SQLコマンドを介して表示させるか、あるいはその際、(リンクしている)テーブルに遡ってアクセスするかを指定します。関連あるフィールド 属性で、インデックスを使って、クエリーあるいはテーブルのどのデータフィールドとリストボックスがリンクしているかを指定します。

note

関連あるフィールド 属性は、複数のテーブルにアクセスするフォームに対してのみ使用します。単独のテーブルのみを使用するフォームの場合、フォームに表示するフィールドは、データフィールド に指定します。リストボックスに表示させるデータを、共通データフィールドを介在して現在のテーブルにリンクしたテーブルから読み出する場合は、リンクしたデータフィールドを 関連あるフィールド 属性に指定します。


リストの内容の種類 で「sql」を選択した場合は、SQLコマンドによりインデックスを指定します。例:SQLコマンドとして リストの内容 に「SELECT Field1, Field2 FROM tablename」のように指定すると、テーブルは下記のように参照されます。

関連あるフィールド

リンク

-1

The index of the selected entry in the list is linked to the field specified under Data field.

{empty} or 0

データベースフィールド「Feld1」は、データフィールド で入力したフィールドにリンクされています。

1

データベースフィールド「Feld2」は、データフィールド で入力したフィールドにリンクされています。


リストの内容の種類 で「テーブル」を選択した場合は、使用するインデックスはテーブル構造により規定されます。例:リストの内容 でデータベーステーブルを選択した場合、テーブルは下記のように参照されます。

関連あるフィールド

リンク

-1

The index of the selected entry in the list is linked to the field specified under Data field.

{empty} or 0

テーブルの第1列は、データフィールド で入力したフィールドにリンクしています。

1

テーブルの第2列は、データフィールド で入力したフィールドにリンクしています。

2

テーブルの第3列は、データフィールド で入力したフィールドにリンクしています。


ご支援をお願いします!