rhservan
asked on
Can I write this in an expression or is there a better way in custom code?
Let me know if you need additional clarity to my question!
Current: This works as needed.
=Right(Fields!REASONB.Valu e,Len(Fiel ds!REASONB .Value) - InStrRev(Fields!REASONB.Va lue,"-"))
This expression removes all characters from first instance of '-', located from the right end of string, to the beginning of the string.
Example:
When expression runs on data below
ReasonB
SMPLT - QSY - Error 1234
Returns
ReasonB
Error 1234
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
Desired:
In addition to the above expression I would like to COMPARE Fields!REASONB.Value with Fields!REASONA.Value
For an example:
If Fields!REASONB = Fields!REASONA Make ReasonB column blank.
ReasonA ReasonB
SMPLT - QSY - Error 1234 SMPLT - QSY - Error 1234
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234
OR
If Fields!REASONB <> Fields!REASONA Return Maintain what is already in Fields!REASONB
ReasonA ReasonB
SMPLT - QSY - Error 1234 Flooding
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234 Flooding
Current: This works as needed.
=Right(Fields!REASONB.Valu
This expression removes all characters from first instance of '-', located from the right end of string, to the beginning of the string.
Example:
When expression runs on data below
ReasonB
SMPLT - QSY - Error 1234
Returns
ReasonB
Error 1234
--------------------------
Desired:
In addition to the above expression I would like to COMPARE Fields!REASONB.Value with Fields!REASONA.Value
For an example:
If Fields!REASONB = Fields!REASONA Make ReasonB column blank.
ReasonA ReasonB
SMPLT - QSY - Error 1234 SMPLT - QSY - Error 1234
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234
OR
If Fields!REASONB <> Fields!REASONA Return Maintain what is already in Fields!REASONB
ReasonA ReasonB
SMPLT - QSY - Error 1234 Flooding
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234 Flooding
Do you want the A and B check to be done before the modification of B or after?
ASKER
I would want to remove the duplicates as explained in the desired first.
Then the string segement removal as in current second.
Then the string segement removal as in current second.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
It seems the expression above is only returning the Else portion of the IIF.
Example:
ReasonA ReasonB
SMPLT - QSY - Error 1234 SMPLT - QSY - Error 1234 <-------duplicate to ReasonA (=)
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234 Error 1234 <-------- Should be nothing
Example:
ReasonA ReasonB
SMPLT - QSY - Error 1234 SMPLT - QSY - Error 1234 <-------duplicate to ReasonA (=)
Returns
ReasonA ReasonB
SMPLT - QSY - Error 1234 Error 1234 <-------- Should be nothing
ASKER
I found an issue with ReasonB. There is a trailing space on some of the comparisons which causes the problem with ReasonA = ReasonB due to the additional space.
I will correct this and let you know.
I will correct this and let you know.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.