0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OutSystemsでStructureを使ってみよう

Posted at

はじめに

StructureとはC言語などで言う構造体と同じようなものです。
異なる複数のデータ型をまとめて1つのデータ型にすることができます。
この説明ではわかりにくいかもしれないので実際に使いながら説明していきます。

使用例

例えばこのように年度、費目、月毎の金額(12ヶ月分)を入力する入力フォームを作るとします。
この入力欄1つ1つにVariableを割り当てていくと、それだけで14個のVariableが必要となりますし、Actionなどにこの情報を渡したい場合もInput Parameterを14個設定する必要があるため、非常に面倒なことになります。
image.png
そこで便利なのがStructureです。
まずDataタブのStructuresを右クリックし、Add Structureを選択します。
image.png
Structureが作成されるので適当な名前をつけ、後はEntityを作る時と同じ要領でAttributeを追加していき、それぞれの名前やデータ型などを設定します。
image.png
これで年度、費目、月毎の金額(12ヶ月分)をまとめたStructureができました。
image.png
あとはVariableを作る際に、データ型をそのStructureに設定すれば1つのVariableに年度、費目、月毎の金額(12ヶ月分)を全て持たせることができます。
image.png
またデータ型がStructureのVariableをForm Widgetにドラッグ&ドロップすると入力フォームを自動生成することもできます。
image.png
image.png

最後に

Structureは初めは取っ付きにくいかもしれませんが、慣れると開発の手間がかなり減らせますので是非使ってみてください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?