Question
Pega
IN
Last activity: 1 Aug 2018 2:56 EDT
How to Verify that given string is Germany using validation in pega
- Verify that the Country Applying for is either "Germany" or "Switzerland". If it is not, then display an error message as follows:
"Student Travel Policy can be issued only for Germany or Switzerland"
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
IN
Hi Avinash,
Seems you need below expresssion.
@notEqualsIgnoreCase(.yourProperty,"Germany")||@notEqualsIgnoreCase(.yourProperty,"Switzerland")
Regards,
Vinay Reddy
Vodafone
IN
Hello Avinash,
Thanks for your post on PSC.
The summary heading and description mentioned in the post seems quite different. Considering the description of the Post "Student Travel Policy can be issued only for Germany or Switzerland".
You are searching a String "Germany" in the sentence.
Request to use edit validate rule on a property or an activity with java step on onChange and you may use the below sample java code to verify
public class HelloWorld {
public static void main(String[] args) {
String text = "theValue";
System.out.print(text.contains("Germany"));
}
}
Based on the return value you can take further actions.
Pegasystems Inc.
IN
Hello Avinash,
Use the above approach or you can use below approaches.
Approach 1:
validate using validate rule.
Write a validate rule and use below function in it.
@equalsIgnoreCase(.yourProperty,"Germany")||@equalsIgnoreCase(.yourProperty,"Switzerland")
Call this validate rule in your flow action.
Approach 2:
If you are using any activity in post processing of flow action then you can validate in that activity it self.
-->Check when condition before executing that step .
-->Then if when condition is true then continue whens else skip step.
-->Use Property-Set-Messages method and set your message there.
Regards,
Vinay Reddy
Pega
IN
when used approach 1 , the functionality is quite opposite to the ques i posted. can u look into it again
CollabPartnerz
IN
1) Use Validate rule (Check for string equals to germany, if when evaluates to true then fire validation)
2) Use activity(Check for string equals to germany, if when evaluates to true set property-set-Messages/Page-set-Message)
CollabPartnerz
IN
Please use the validate rule in a flow action with condition of @equalsIgnoreCase(.yourProperty,"Germany")||@equalsIgnoreCase(.yourProperty,"Switzerland")
Bits In Glass
GB
Hi Avinash,
If we want to follow pega best practices, we have to avoid custom java code.
So you can choose any approach (Approach 1, Approach 2) suggested by @VinayReddy7.
And use "Message" rule for displaying error message, so that it can be reusable.
Thanks
-
Elena Martín Tarini Prasad Dash José Luis Laviña Hugo Gilarranz Nieto Victor Diez and 5 More
Pegasystems Inc.
IN
Hey Still are you looking for solution..?
Pega
IN
Yes
Accepted Solution
Pegasystems Inc.
IN
Hi Avinash,
Seems you need below expresssion.
@notEqualsIgnoreCase(.yourProperty,"Germany")||@notEqualsIgnoreCase(.yourProperty,"Switzerland")
Regards,
Vinay Reddy