Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple If Statements

Status
Not open for further replies.

dadyswat

Technical User
Aug 18, 2006
12
US
I'm trying to pull only values above a certain value. I'm getting errors on the statement in general. Record selection formula looks like this:

{OB_0001.vccid} in [22, 32] and
{AX_0001_B.EndDate} in {?AXStartDate} to {?AXEndDate} and
{IVUEAPPVCCNODEPATHS.appid} = 1 and
{IX_0001.CASE_STATUS} in ["CDAL", "CDEA", "CMMC", "CMMI", "CMNC", "CNCM", "CNMCO", "CNMN", "CNMS", "CNWK", "CPTD", "CRET", "CSET", "CSOL", "CWNM", "CWRK", "NEW", "TRAN"] and
{AX_0001_B.DocReviewStatus} = 1 and
{AX_0001_LUT.id} = 8 and
{AX_0001_LUT2.id} = 6 and
{AX_0001_LUT2.valuetext} in ["Retro", "Inactive Retro", "Inactive Current", "Current"] and
{AX_0001_B.AppealType} in [20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] and
{AX_0001_B.C9Type} in [6, 1, 2, 4, 5]
if {AX_0001_LUT2.valuetext}= "Current" and
{AX_0001_LUT.valuecode} in [1,2,3,7,8,9,10,11,12,15,16,17,18,20] and {@Number_of_Days}>3
then {@Number_of_Days}
if {AX_0001_LUT2.valuetext}="Current Pended"
and {AX_0001_LUT.valuecode} in [4,5,6,10,11] and {@Number_of_Days}>20 then {@Number_of_Days}
if {AX_0001_LUT2.valuetext}="Retro" and {AX_0001_LUT.valuecode} in [4,5,6,10,11,12,14,15,16,17,20]and {@Number_of_Days}>30 then {@Number_of_Days}
else {@Number_of_Days}=0
 
Not sure what you're trying to do here. If you want to limit the number of days based on the values of the other two fields, try the following (Note that you reference a value "Current Pended" that was not selected in a previous clause, so I added it).

{OB_0001.vccid} in [22, 32] and
{AX_0001_B.EndDate} in {?AXStartDate} to {?AXEndDate} and
{IVUEAPPVCCNODEPATHS.appid} = 1 and
{IX_0001.CASE_STATUS} in ["CDAL", "CDEA", "CMMC", "CMMI", "CMNC", "CNCM", "CNMCO", "CNMN",
"CNMS", "CNWK", "CPTD", "CRET", "CSET", "CSOL", "CWNM", "CWRK",
"NEW", "TRAN"] and
{AX_0001_B.DocReviewStatus} = 1 and
{AX_0001_LUT.id} = 8 and
{AX_0001_LUT2.id} = 6 and
{AX_0001_LUT2.valuetext} in ["Retro", "Inactive Retro", "Inactive Current", "Current", "Current Pended"] and
{AX_0001_B.AppealType} in [20, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] and
{AX_0001_B.C9Type} in [6, 1, 2, 4, 5] and
(
(
{AX_0001_LUT2.valuetext}= "Current" and
{AX_0001_LUT.valuecode} in [1,2,3,7,8,9,10,11,12,15,16,17,18,20] and
{@Number_of_Days} > 3
) or
(
{AX_0001_LUT2.valuetext}="Current Pended" and
{AX_0001_LUT.valuecode} in [4,5,6,10,11] and
{@Number_of_Days} > 20
) or
(
{AX_0001_LUT2.valuetext}= "Retro" and
{AX_0001_LUT.valuecode} in [4,5,6,10,11,12,14,15,16,17,20] and
{@Number_of_Days} > 30
) or
{@Number_of_Days} = 0
)

-LB
 
On general principles of good coding, I'd break the command down into a number of 'boolians'. Make a formula with a name like @End_Date_OK,
Code:
 {AX_0001_B.EndDate} in {?AXStartDate} to {?AXEndDate}

The same for all your other tests. You can then display then with your data and without selection, so it will show 'True' or 'False'. Once you're sure it works, put them into the selection, just as @End_Date_OK

I assume lbass's fix will work, but a rewrite will pay off in the long run.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods change between versions, and higher versions have extra options.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hey thanks guys, I've got it figured out and its giving me what I need. You're the best!!
 
dadyswat, it's good to thank people, but don't assume that all of them are male. I am, but lbass isn't.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top