Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008
    Posts
    2

    Unanswered: Problem With Case Statement within formula

    I am trying to run a Crystal report which has a formula in it (written using Crystal syntax). The formula has a select...case statement which executes other formulas according to the case statement. The problem is that it appears to execute all the fomulas onward from the one which it actually should (rather then just the correct one). Does anyone know why this might occur and how it might be corrected?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Care to post your code?
    George
    Home | Blog

  3. #3
    Join Date
    Jun 2008
    Posts
    2
    In the first formula the code is

    select {base_call.product}
    case 31 : result_num := {@F025 Count Gadgroc}
    case 32 : result_num := {@F025 Count Wakegroc}
    case 33 : result_num := {@F025 Count Bellgroc}
    case 34 : result_num := {@F025 Count Stocgroc}
    case 35 : result_num := {@F025 Count Latpgroc}
    case 36 : result_num := {@F025 Count Yategroc}
    case 41 : result_num := {@F025 Count Froz}
    case 51 : result_num := {@F025 Count Swangroc}
    case 52 : result_num := {@F025 Count Bathgroc}
    case 53 : result_num := {@F025 Count Teesgroc}
    case 54 : result_num := {@F025 Count Wakebeers}
    case 61 : result_num := {@F025 Count Swangroc}
    case 62 : result_num := {@F025 Count Grandhl}
    default : result_num := 0

    In the formula "{@F025 Count Wakegroc}" which I am executing the code is

    {base_call.routeno};
    {base_call.tripno};

    //if {base_call.product} <> 32 then upperbound_store_num := 1001;

    if csc_inc_wakegroc < 1 then
    for i := 1 to upperbound_store_num do (csc_wakegroc_arr[i] := 0);
    //************************************************** **********************************************
    //**************************** ACCUMULATE ARRAY VALUES *******************************************
    if numericText({base_call.orddets1}) = true then
    if toNumber({base_call.orddets1}) <= upperbound_store_num then
    csc_wakegroc_arr[toNumber({base_call.orddets1})] := csc_wakegroc_arr[toNumber({base_call.orddets1})] + 1;

    (upperbound_store_num is set at 1000 - when I uncomment the line
    "//if {base_call.product} <> 32 then upperbound_store_num := 1001"
    it shows on the dump that {base_call.product} 41 has caused the formula
    "{@F025 Count Wakegroc}" to execute)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •