簡単なリポジトリ フィールドとテーブル規則を使ってフィールドを検証します
ビュー (PRIM_VIEW) のメンバ
名前 | タイプ | データ タイプ | 記述 |
---|---|---|---|
Valid | *Result (任意) | ブール値 | フィールドが妥当性規則を渡す場合、TRUE を返します |
Operation | *Input | 列挙 | フィールド検証の対象となるオペレーション (挿入、更新、削除) |
Table | *Input (任意) | PRIM_OBJT | 検証に使用されるテーブル |
Validate メソッドにより、ファイルやフィールドの規則に対する、ダイアログに含まれるフィールドの検証ができるようになります。 検証処理は、挿入、更新、削除時の検証に利用できます。 Valid パラメータが FALSE で返された場合、フィールドの HasError プロパティに TRUE が設定されます。 LANSA テーブルに対し検証するには、テーブル名に接頭辞 '#' が必要です。 この Validate メソッドには、複雑なロジックや検索規則は導入されていません。
以下の例では、ビュー内のフィールドが、 xEmployee テーブルに対して検証されています。
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME) Define_Com Class(#PRIM_TBLO) Name(#Layout1) Define_Com Class(#PRIM_TBLO.Row) Name(#Layout1Row1) Parent(#Layout1) Displayposition(1) Define_Com Class(#PRIM_TBLO.Column) Name(#Layout1Column1) Parent(#Layout1) Displayposition(1) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item1) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeIdentification) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item2) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeSurname) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item3) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeGivenNames) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item4) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeStartDate) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item5) Alignment(TopLeft) Column(#Layout1Column1) Manage(#ButtonValidate) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8) Define_Com Class(#PRIM_TBLO) Name(#Layout2) Define_Com Class(#PRIM_TBLO.Row) Name(#Layout2Row1) Displayposition(1) Parent(#Layout2) Define_Com Class(#PRIM_TBLO.Column) Name(#Layout2Column1) Displayposition(1) Parent(#Layout2) Define_Com Class(#PRIM_TBLO.Item) Name(#Layout2Item1) Column(#Layout2Column1) Manage(#ViewContainer) Parent(#Layout2) Row(#Layout2Row1) Define_Com Class(#prim_md.ViewContainer) Name(#ViewContainer) Parent(#COM_OWNER) Displayposition(1) Tabposition(1) Height(800) Width(1200) Define_Com Class(#PRIM_View) Name(#View) Layoutmanager(#Layout1) Displayposition(1) Parent(#ViewContainer) Height(800) Left(400) Tabposition(1) Width(1200) Define_Com Class(#xEmployeeIdentification.EditField) Name(#xEmployeeIdentification) Parent(#View) Displayposition(1) Tabposition(4) Left(8) Top(8) Width(1184) Define_Com Class(#xEmployeeSurname.EditField) Name(#xEmployeeSurname) Parent(#View) Displayposition(2) Tabposition(3) Left(8) Top(91) Width(1184) Define_Com Class(#xEmployeeGivenNames.EditField) Name(#xEmployeeGivenNames) Parent(#View) Displayposition(3) Tabposition(2) Left(8) Top(174) Width(1184) Define_Com Class(#xEmployeeStartDate.DateTimeField) Name(#xEmployeeStartDate) Parent(#View) Displayposition(4) Tabposition(1) Left(8) Top(257) Width(1184) Define_Com Class(#prim_md.FlatButton) Name(#ButtonValidate) Parent(#View) Displayposition(5) Tabposition(5) Caption('Validate') Left(8) Top(340) Width(1184) Evtroutine Handling(#COM_OWNER.Initialize) #View.show Endroutine Evtroutine Handling(#ButtonValidate.Click) #View.Validate( Update #xEmployee ) Endroutine End_Com
EPC142030 February 2019