Question


DB
DE
Last activity: 19 Apr 2016 9:43 EDT
Determine a certain string value within a property
Hi everybody,
i guess i need some Support in case of ignorance
There is a property which could have different string values. So I want to check this property if it contains the string value "prof" or "des"! If this is the case the property should be rewritten with "prof" or "des".
Example:
Property Value origin :"Major Srgt PD Professor med"
Property new Value: "Prof."
I checked the Expression builder and the String(Pega-Rules) library. I found a function called "contains" which returns only true and false. Is there a possibility to check the string and change the value within one function?
Thank you and best regards
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Citicorp Services India Private Limited
IN
Hi Norman,
Will the following expression helps @if(@String.contains(Param.Test,"Prof"),"Prof",Param.Test)
Here Param.Test is the property which holds the value.
Please let me know if this helps?.
Thanks,
Gowrishankar
-
ABHISHEK ANAND


DB
DE
thanks, i will try to test it!
-
Genie Yee


DB
DE
hi,
i guess @String does not exist, i got following validate error message:
Expression is not Valid. Error Messages are shown below.
Invalid expression or reference: line 1:11 missing '(' at '.'
@if(@String.contains(Param.Test,"Prof"),"Prof",Param.Test)
^
line 1:31 extraneous input ',' expecting {'-=', '*', '-', '<', '!=', '<=', '?', '~=', '+=', '^=', '%', '*=', ')', '.', '+', '<>', '=', '&&', '||', '>', '%=', '/=', '==', '/', '>='}
@if(@String.contains(Param.Test,"Prof"),"Prof",Param.Test)
^


Citicorp Services India Private Limited
IN
Hi Norman,
Which versions of PRPC are you using?.
Thanks,
Gowrishankar.


DB
DE
PRPC 7.1.7
following could work:
@if(@contains("Prof", Param.Test), "Prof", "")
but if i try to use an @or Expression like this:
@or(@if(@contains("Prof", Param.Test), "Prof", ""),@if(@contains("Dr", Param.Test), "Dr", ""))
i thought it could easily work but this Expression is not valid too:
Invalid expression or reference: Error: The operands for the @and/@or function should be of type boolean


Pegasystems Inc.
ES
Hi Norman,
Could you try the following? :
- @contains(Param.Value1, "Prof")?"Prof":Param.Value1
In case, the string contains the required value, it would assign that value to the Property, otherwise the initial value will be retained.


Citicorp Services India Private Limited
IN
Hi Norman,
This expression @or(@if(@contains("Prof", Param.Test), "Prof", ""),@if(@contains("Dr", Param.Test), "Dr", "")) will not work, because the "if" function does not return Boolean values here.
I would suggest you to use Decision table and use Property-Map-DecisionTable method in activity to get the expected results.
Let me know if this helps?
Thanks,
Gowrishankar.


Process 360
IN
Hi Norman,
Can you check if this is of any help to you
@if(@(Pega-RULES:String).contains(Param.InputString,"Prof"),"Prof",@if(@(Pega-RULES:String).contains(Param.InputString,"Dr"),"Dr",Param.InputString))
Thanks,
Bhanu Prakash G.


DB
DE
hi everybody,
i kept it quite simple like this:
@if(@contains(NBAACustomerRef.Customer.AKADGRAD,"Prof"), "Prof.", @if(@contains(NBAACustomerRef.Customer.AKADGRAD,"Dr"), "Dr.", @if(@contains(NBAACustomerRef.Customer.AKADGRAD,"Dres"), "Dres.", "")))
I think that should match!
Thanks