Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Too Many IF Statements in one formula Post Reply Post New Topic
Author Message
Selimse
Newbie
Newbie
Avatar

Joined: 11 Feb 2010
Location: Turkey
Online Status: Offline
Posts: 4
Quote Selimse Replybullet Topic: Too Many IF Statements in one formula
     Posted: 11 Feb 2010 at 1:16pm
In one of my crystal report, I need to check too many parameters to assign a value to a formula. I write the code below (in basic syntax), but it is not working properly. In the report i can only see the value of the formula if it is in the first three cases. Formula does not gives "WAITING FOR ACCEPTANCE", "INSPECTION REJECTED", "IN INSPECTION", "IN RECEIVING", "IN CUSTOMS" values, It returns blank values instead of these values. But i can easly find lines that have to be one of these values. Also if i delete one of the elseif statement that works (for example: ELSEIF {BOMMAIN.TEMSEKLI} = "F" THEN FORMULA = "FURNISH" statement) then the next elseif statement starts to work and gives "WAITING FOR ACCEPTANCE" values.

Can anybody help me about this problem? Thanks in advance.

If {'SHORT_REPORT_'.STATU} = "REMNANT" OR {'SHORT_REPORT_'.STATU} = "TRANSFER" OR {'SHORT_REPORT_'.STATU} = "ALTERNATİF" OR {'SHORT_REPORT_'.STATU} = "METAR" OR {'SHORT_REPORT_'.STATU} = "NON-METALLIC" OR {'SHORT_REPORT_'.STATU} = "SC-PART" OR {'SHORT_REPORT_'.STATU} = "HARDWARE" OR {'SHORT_REPORT_'.STATU} = "FURNISH" THEN
    FORMULA = {'SHORT_REPORT_'.STATU}
ELSEIF {VSUMSTOK.TPL_ALLOC_QTY1}>0 THEN
        FORMULA = "IN STOCK"
ELSEIF {BOMMAIN.TEMSEKLI} = "F" THEN
        FORMULA = "FURNISH"
ELSEIF {V_ACIK_PO_MUAYENE.KESIN_KABUL_BEKLEYEN} >0 THEN
        FORMULA = "WAITING FOR ACCEPTANCE"
ELSEIF {V_ACIK_PO_MUAYENE.MUAYENE_RED}>0 THEN
        FORMULA = "INSPECTION REJECTED"
ELSEIF {V_ACIK_PO_MUAYENE.GECICI_KABUL}>0 THEN
        FORMULA = "IN INSPECTION"
ELSEIF {V_POITEM_CIKIS_MIKTAR.CIKAN_MIKTAR} - {V_MQT_PO_RR_QUANTITY.RECEIVEDQTY} > 0 THEN
        FORMULA = "IN RECEIVING"
ELSEIF     {ANTREPO.MIKTAR}>0 THEN
        FORMULA = "IN CUSTOMS"
END IF

Edited by Selimse - 11 Feb 2010 at 1:17pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Feb 2010 at 7:35pm
do you have to evaluate for nulls?
If so change the setting in your formula to "use default values for nulls"
IP IP Logged
Selimse
Newbie
Newbie
Avatar

Joined: 11 Feb 2010
Location: Turkey
Online Status: Offline
Posts: 4
Quote Selimse Replybullet Posted: 11 Feb 2010 at 9:15pm
Nop, no Null values exist in my tables...
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Feb 2010 at 8:02am
What about NULLS due to outerjoins?
IP IP Logged
Selimse
Newbie
Newbie
Avatar

Joined: 11 Feb 2010
Location: Turkey
Online Status: Offline
Posts: 4
Quote Selimse Replybullet Posted: 27 Feb 2010 at 7:26am

DBlank thank you for your reply. I have some outer joints and it works when i select "use default values for nulls". Thanks a lot...

IP IP Logged
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