Re: How to preprocess part of information of excel in CP

Thank you for the help with syntax.

As I want to know the disciplines that can use rooms with capacity <= 300 pp , after I try your code and adjust it a bit as follows

 

int nbStudentPerDiscipline[d in Discipline]=
(card({n | in StudentDiscipline })==0)?0:first({n | in StudentDiscipline });
{string} DisciplineForLargeroom[n in NbStudent] =
  { d | in StudentDiscipline: nbStudentPerDiscipline[d] <= 300};
 //maybe wrong due to Nbstudent has no repeat

 

I got in scripting log

nbStudentPerDiscipline =   [55 22 34 120 16 3 86 47 51 49 37 0 23 0 0] DisciplineForLargeroom =   [{“Biology”} {“Economy”} {“French”} {“Geography”} {“History”} {“Maths”} {“Physics”}
         {“Sport”} {“a”} {“e”} {“c”} {“b”}]

 

My questions are:

1.

I don’t understand why there are zeros in nbStudentPerDiscipline. Moreover, when I open the table of nbStudentPerDiscipline  from Problem browser winder, it does not look like in scripting log at all.

 

2.

DisciplineForLargeroom should contains all disciplines but the result contain only 12 subjects. I guess it maybe wrong due to the nonrepeat number of Nbstudent

what I should do in this case.

 

Regards.

 

 

 

Source: Re: How to preprocess part of information of excel in CP