Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2016 : Report Design  
Message Icon Topic: If Statement with 2 Tables Post Reply Post New Topic
Author Message

Joined: 14 Apr 2015
Online Status: Offline
Posts: 4
Quote JediSkipdogg Replybullet Topic: If Statement with 2 Tables
    Posted: Today at 8:17am
I have two tables linked together. The second table has a column at the end that has a version number for the record based on changes in the state crash reporting system. The formula is doing what I want it to do EXCEPT it is returning two results for a single record. It is returning both an actual Contour (the correct one) AND the N/A.

So {P_ACCID_OH_TAB.ROAD_CONTOUR_CD} returns a blank (assuming null) value or number 1-9. That then links to P_ROAD_CONTOUR_CD_VIEW which looks like this...

column_value     column_value_desc     column_abbr     rollup_column_value     rollup2_column_value     jxdm_rollup_value     status_cd     catg_desc     tree_order     version
1     Straight Level          1          1     L               1
1     Straight Level          1          1     L               2
2     Straight Grade          2          2     L               1
2     Straight Grade          2          2     L               2
3     Curve Level          3          3     L               1
3     Curve Level          3          3     L               2
4     Curve Grade          4          4     L               1
4     Curve Grade          4          4     L               2
9     Unknown          9          9     L               2

I created the following formula so it returns data no matter what. It is that last column where there is a 1 or 2 that is kicking my butt. I only need it to return the description from above if there is something in P_ACCID_OH_TAB.ROAD_CONTOUR_CD and when it returns, it needs to return what version 2 is and not the same record twice if that makes sense.

Local StringVar Contour;

if not isnull({P_ACCID_OH_TAB.ROAD_CONTOUR_CD}) and {P_ROAD_CONTOUR_CD_VIEW.version}=2 then Contour:={P_ROAD_CONTOUR_CD_VIEW.column_value_desc} else Contour:="N/A";

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

This page was generated in 0.047 seconds.