KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

IF condition on Index file with Data column #281

Open arthur opened this topic on on May 14, 2018 - 2 comments

arthur commented on May 14, 2018

Hi,

I would like to define business targets depending on the month (which is defined in a string column name 'Date' of my excel file). It would look like this :

switch ($_SESSION['Username']) {
    case 'LBENOIT':
if ($data["Date"] == 'JANVIER' || $data["Date"] == 'FEVRIER' || $data["Date"] == 'MARS' )  {
    
$objectif_FAS = 22500;
$objectif_REC = 600;
} else {
  $objectif_FAS = 2500;
  $objectif_REC = 6; 
}

      break; 

I put the code at the top of my index file, but it doesnt work. What should I do ?

Thanks !

KoolReport commented on May 15, 2018

Why dont you create a CalculatedColumn named "business_target" generated from the Date column. You apply above rule and then you will have new column for your later calculation.

arthur commented on May 15, 2018

Ok. What the code would look like ?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Excel