はじめに
PEGAでバリデーションを実装する際に、毎回以前の実装を探しに行っているので、この記事でまとめるともにバリデーションの紹介をしたいと思います。
バリデーション紹介
必須(エラーメッセージを自分で設定したい場合など)
Select a function:value is [expression]
value is {""}
電話番号
半角数字のみ+ハイフンなし
Select a function:[expression evaluates to true]
!@pxContainsViaRegex(.YourProperty,"^[0-9]{11}$",true)
半角数字のみ+ハイフンあり
Select a function:[expression evaluates to true]
!@pxContainsViaRegex(.YourProperty,"^[0-9]{3}-[0-9]{4}-[0-9]{4}$",true)
半角大小英字+半角数字+15桁
Select a function:[expression evaluates to true]
!@pxContainsViaRegex(.YourProperty,"^[A-Z,a-z,0-9]{15}$",true)
全角大小英字+全角スペース
Select a function:[expression evaluates to true]
!@pxContainsViaRegex(.YourProperty,"^[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\u3000]*$",true)
15桁以下で入力
Select a function:length of [a pagelist property] is [comparison operator] [value]
length of {.YourProperty} is Greater Than {15}
ステージでバリデーションを適用する
Select a function:[expression evaluates to true]
.pxCurrentStage == "YourStageName"
ANDで条件を続ける
デフォルトのバリデーションを適用させる(「DateyyyyMMdd」など)
Select a function:Validation of [Property Name] using [Edit Validate Name] fails
Validation of {.YourProperty} using {ValidateName}
おまけ
エラーメッセージでプロパティの値を入れたい時、「Message」の中でプロパティを"と+で囲うことによって可能です。
入力された " + .YourProperty + "の形式が間違っています。
おわりに
ほとんど自分で見直すようで記事を書きましたが、これからバリデーションを実装する方の参考になったら幸いです