[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Compare field results of a shared variable

Posted on 2011-05-12
4
Medium Priority
?
222 Views
Last Modified: 2012-06-27
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!
0
Comment
Question by:jph826
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 35747701
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?
0
 
LVL 19

Expert Comment

by:GJParker
ID: 35748028
Best to give an example of your data and the desired outcome
0
 

Author Comment

by:jph826
ID: 35749455
Sorry, it's hard to explain and thanks for your patience.  Please see attached print screen example.
example.pdf
0
 
LVL 19

Accepted Solution

by:
GJParker earned 2000 total points
ID: 35752713

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

//@Compare
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'
    Else
        Result := 'New'

Result

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

//@Reset
Shared StringVar Old_Dep := ''

Open in new window

     


 
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question