Compare field results of a shared variable

I have a Crystal Report based on a table that uses a shared variable field and each field value is associated with a sequence number.  For example:

each {WFVARIABLE.WF_SEQ_NBR} will have a {WFVARIABLE.VARIABLE_VALUE},  For example seq nbr 4 is "old dept", seq nbr 5 is "new dept".

I need a formula that compares the values of seq 4 and seq 5.  Something that says if the value of seq nbr 4 does not match the value of seq nbr 5 then "N".

I have several different seq nbrs and values I need to compare, so any help would be most appreciated.  Thanks!
Who is Participating?

To be able to do this using your resultset you will need to ensure that the old_department record is always before the new department record.

If this is true then try adding this formula on to the report

Shared StringVar Old_Dep;
Local StringVar Result;

If {WFVariable.Variable_Name} = 'Old_Department' Then
    Old_Dep := {WFVariable.Variable_Value}
Else If {WFVariable.Variable_Name} = 'New_Department' Then
    If {WFVariable.Variable_Value} = Old_Dep Then
        Result := 'Same'
        Result := 'New'


Open in new window

If you have a group on WorkUnit then you will also need to add a formula to the group header section to reset the Old_Dep variable

Shared StringVar Old_Dep := ''

Open in new window


I don't understand what you are describing.

If ...  "seq nbr 4 is "old dept", seq nbr 5 is "new dept"."  ...  then how can seq nbr 4 ever be equal to seq nbr 5?
Best to give an example of your data and the desired outcome
jph826Author Commented:
Sorry, it's hard to explain and thanks for your patience.  Please see attached print screen example.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.