# Conventions :
# - data are not checked (this is not the role of the model).
#----------------------------------------------------------------------------------------------------------------------

#----------------------------------------------------------------------------------------------------------------------
# Loading parameters
#----------------------------------------------------------------------------------------------------------------------

param PPerDur {1..1} integer;
param PNbPer  {1..1} integer;
param PRefPer {1..1} integer;
param PNA     {1..1} symbolic;
param PHuge   {1..1};

table PARAMETERS IN 'ODBC'
  'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};dbq=.\exemple-format-excel.xlsx'
  'SELECT * FROM [PARAMETERS$]':
  [PLine],PPerDur, PNbPer, PRefPer, PNA, PHuge;

param PerDur integer  := PPerDur[1];
param NbPer  integer  := PNbPer [1];
param RefPer integer  := PRefPer[1];
param NA     symbolic := PNA    [1];
param Huge            := PHuge  [1];

display "PARAMETERS", PerDur, NbPer, RefPer, NA, Huge; 

#----------------------------------------------------------------------------------------------------------------------
# Loading crop parts (CPYield not loaded)
#----------------------------------------------------------------------------------------------------------------------

set   CPID;
param CPCrop {CPID} symbolic;
param CPName {CPID} symbolic;
param CPType {CPID} symbolic;

table CROP_PARTS IN 'ODBC'
  'DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}; dbq=.\exemple-format-excel.xlsx'
  'SELECT * FROM [CROP_PARTS$]': 
  CPID <- [CPID], CPCrop, CPName, CPType;

display "CROP_PARTS", CPID, CPCrop, CPName, CPType;

end;
