Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Calculation;
   4  
   5  /**
   6   * @deprecated 1.17.0
   7   */
   8  class Database
   9  {
  10      /**
  11       * DAVERAGE.
  12       *
  13       * Averages the values in a column of a list or database that match conditions you specify.
  14       *
  15       * Excel Function:
  16       *        DAVERAGE(database,field,criteria)
  17       *
  18       * @Deprecated 1.17.0
  19       *
  20       * @see Database\DAverage::evaluate()
  21       *      Use the evaluate() method in the Database\DAverage class instead
  22       *
  23       * @param mixed[] $database The range of cells that makes up the list or database.
  24       *                                        A database is a list of related data in which rows of related
  25       *                                        information are records, and columns of data are fields. The
  26       *                                        first row of the list contains labels for each column.
  27       * @param int|string $field Indicates which column is used in the function. Enter the
  28       *                                        column label enclosed between double quotation marks, such as
  29       *                                        "Age" or "Yield," or a number (without quotation marks) that
  30       *                                        represents the position of the column within the list: 1 for
  31       *                                        the first column, 2 for the second column, and so on.
  32       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
  33       *                                        You can use any range for the criteria argument, as long as it
  34       *                                        includes at least one column label and at least one cell below
  35       *                                        the column label in which you specify a condition for the
  36       *                                        column.
  37       *
  38       * @return null|float|string
  39       */
  40      public static function DAVERAGE($database, $field, $criteria)
  41      {
  42          return Database\DAverage::evaluate($database, $field, $criteria);
  43      }
  44  
  45      /**
  46       * DCOUNT.
  47       *
  48       * Counts the cells that contain numbers in a column of a list or database that match conditions
  49       * that you specify.
  50       *
  51       * Excel Function:
  52       *        DCOUNT(database,[field],criteria)
  53       *
  54       * @Deprecated 1.17.0
  55       *
  56       * @see Database\DCount::evaluate()
  57       *      Use the evaluate() method in the Database\DCount class instead
  58       *
  59       * @param mixed[] $database The range of cells that makes up the list or database.
  60       *                                        A database is a list of related data in which rows of related
  61       *                                        information are records, and columns of data are fields. The
  62       *                                        first row of the list contains labels for each column.
  63       * @param null|int|string $field Indicates which column is used in the function. Enter the
  64       *                                        column label enclosed between double quotation marks, such as
  65       *                                        "Age" or "Yield," or a number (without quotation marks) that
  66       *                                        represents the position of the column within the list: 1 for
  67       *                                        the first column, 2 for the second column, and so on.
  68       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
  69       *                                        You can use any range for the criteria argument, as long as it
  70       *                                        includes at least one column label and at least one cell below
  71       *                                        the column label in which you specify a condition for the
  72       *                                        column.
  73       *
  74       * @return int
  75       *
  76       * @TODO    The field argument is optional. If field is omitted, DCOUNT counts all records in the
  77       *            database that match the criteria.
  78       */
  79      public static function DCOUNT($database, $field, $criteria)
  80      {
  81          return Database\DCount::evaluate($database, $field, $criteria);
  82      }
  83  
  84      /**
  85       * DCOUNTA.
  86       *
  87       * Counts the nonblank cells in a column of a list or database that match conditions that you specify.
  88       *
  89       * Excel Function:
  90       *        DCOUNTA(database,[field],criteria)
  91       *
  92       * @Deprecated 1.17.0
  93       *
  94       * @see Database\DCountA::evaluate()
  95       *      Use the evaluate() method in the Database\DCountA class instead
  96       *
  97       * @param mixed[] $database The range of cells that makes up the list or database.
  98       *                                        A database is a list of related data in which rows of related
  99       *                                        information are records, and columns of data are fields. The
 100       *                                        first row of the list contains labels for each column.
 101       * @param null|int|string $field Indicates which column is used in the function. Enter the
 102       *                                        column label enclosed between double quotation marks, such as
 103       *                                        "Age" or "Yield," or a number (without quotation marks) that
 104       *                                        represents the position of the column within the list: 1 for
 105       *                                        the first column, 2 for the second column, and so on.
 106       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 107       *                                        You can use any range for the criteria argument, as long as it
 108       *                                        includes at least one column label and at least one cell below
 109       *                                        the column label in which you specify a condition for the
 110       *                                        column.
 111       *
 112       * @return int
 113       */
 114      public static function DCOUNTA($database, $field, $criteria)
 115      {
 116          return Database\DCountA::evaluate($database, $field, $criteria);
 117      }
 118  
 119      /**
 120       * DGET.
 121       *
 122       * Extracts a single value from a column of a list or database that matches conditions that you
 123       * specify.
 124       *
 125       * Excel Function:
 126       *        DGET(database,field,criteria)
 127       *
 128       * @Deprecated 1.17.0
 129       *
 130       * @see Database\DGet::evaluate()
 131       *      Use the evaluate() method in the Database\DGet class instead
 132       *
 133       * @param mixed[] $database The range of cells that makes up the list or database.
 134       *                                        A database is a list of related data in which rows of related
 135       *                                        information are records, and columns of data are fields. The
 136       *                                        first row of the list contains labels for each column.
 137       * @param int|string $field Indicates which column is used in the function. Enter the
 138       *                                        column label enclosed between double quotation marks, such as
 139       *                                        "Age" or "Yield," or a number (without quotation marks) that
 140       *                                        represents the position of the column within the list: 1 for
 141       *                                        the first column, 2 for the second column, and so on.
 142       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 143       *                                        You can use any range for the criteria argument, as long as it
 144       *                                        includes at least one column label and at least one cell below
 145       *                                        the column label in which you specify a condition for the
 146       *                                        column.
 147       *
 148       * @return mixed
 149       */
 150      public static function DGET($database, $field, $criteria)
 151      {
 152          return Database\DGet::evaluate($database, $field, $criteria);
 153      }
 154  
 155      /**
 156       * DMAX.
 157       *
 158       * Returns the largest number in a column of a list or database that matches conditions you that
 159       * specify.
 160       *
 161       * Excel Function:
 162       *        DMAX(database,field,criteria)
 163       *
 164       * @Deprecated 1.17.0
 165       *
 166       * @see Database\DMax::evaluate()
 167       *      Use the evaluate() method in the Database\DMax class instead
 168       *
 169       * @param mixed[] $database The range of cells that makes up the list or database.
 170       *                                        A database is a list of related data in which rows of related
 171       *                                        information are records, and columns of data are fields. The
 172       *                                        first row of the list contains labels for each column.
 173       * @param int|string $field Indicates which column is used in the function. Enter the
 174       *                                        column label enclosed between double quotation marks, such as
 175       *                                        "Age" or "Yield," or a number (without quotation marks) that
 176       *                                        represents the position of the column within the list: 1 for
 177       *                                        the first column, 2 for the second column, and so on.
 178       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 179       *                                        You can use any range for the criteria argument, as long as it
 180       *                                        includes at least one column label and at least one cell below
 181       *                                        the column label in which you specify a condition for the
 182       *                                        column.
 183       *
 184       * @return float
 185       */
 186      public static function DMAX($database, $field, $criteria)
 187      {
 188          return Database\DMax::evaluate($database, $field, $criteria);
 189      }
 190  
 191      /**
 192       * DMIN.
 193       *
 194       * Returns the smallest number in a column of a list or database that matches conditions you that
 195       * specify.
 196       *
 197       * Excel Function:
 198       *        DMIN(database,field,criteria)
 199       *
 200       * @Deprecated 1.17.0
 201       *
 202       * @see Database\DMin::evaluate()
 203       *      Use the evaluate() method in the Database\DMin class instead
 204       *
 205       * @param mixed[] $database The range of cells that makes up the list or database.
 206       *                                        A database is a list of related data in which rows of related
 207       *                                        information are records, and columns of data are fields. The
 208       *                                        first row of the list contains labels for each column.
 209       * @param int|string $field Indicates which column is used in the function. Enter the
 210       *                                        column label enclosed between double quotation marks, such as
 211       *                                        "Age" or "Yield," or a number (without quotation marks) that
 212       *                                        represents the position of the column within the list: 1 for
 213       *                                        the first column, 2 for the second column, and so on.
 214       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 215       *                                        You can use any range for the criteria argument, as long as it
 216       *                                        includes at least one column label and at least one cell below
 217       *                                        the column label in which you specify a condition for the
 218       *                                        column.
 219       *
 220       * @return float
 221       */
 222      public static function DMIN($database, $field, $criteria)
 223      {
 224          return Database\DMin::evaluate($database, $field, $criteria);
 225      }
 226  
 227      /**
 228       * DPRODUCT.
 229       *
 230       * Multiplies the values in a column of a list or database that match conditions that you specify.
 231       *
 232       * Excel Function:
 233       *        DPRODUCT(database,field,criteria)
 234       *
 235       * @Deprecated 1.17.0
 236       *
 237       * @see Database\DProduct::evaluate()
 238       *      Use the evaluate() method in the Database\DProduct class instead
 239       *
 240       * @param mixed[] $database The range of cells that makes up the list or database.
 241       *                                        A database is a list of related data in which rows of related
 242       *                                        information are records, and columns of data are fields. The
 243       *                                        first row of the list contains labels for each column.
 244       * @param int|string $field Indicates which column is used in the function. Enter the
 245       *                                        column label enclosed between double quotation marks, such as
 246       *                                        "Age" or "Yield," or a number (without quotation marks) that
 247       *                                        represents the position of the column within the list: 1 for
 248       *                                        the first column, 2 for the second column, and so on.
 249       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 250       *                                        You can use any range for the criteria argument, as long as it
 251       *                                        includes at least one column label and at least one cell below
 252       *                                        the column label in which you specify a condition for the
 253       *                                        column.
 254       *
 255       * @return float|string
 256       */
 257      public static function DPRODUCT($database, $field, $criteria)
 258      {
 259          return Database\DProduct::evaluate($database, $field, $criteria);
 260      }
 261  
 262      /**
 263       * DSTDEV.
 264       *
 265       * Estimates the standard deviation of a population based on a sample by using the numbers in a
 266       * column of a list or database that match conditions that you specify.
 267       *
 268       * Excel Function:
 269       *        DSTDEV(database,field,criteria)
 270       *
 271       * @Deprecated 1.17.0
 272       *
 273       * @see Database\DStDev::evaluate()
 274       *      Use the evaluate() method in the Database\DStDev class instead
 275       *
 276       * @param mixed[] $database The range of cells that makes up the list or database.
 277       *                                        A database is a list of related data in which rows of related
 278       *                                        information are records, and columns of data are fields. The
 279       *                                        first row of the list contains labels for each column.
 280       * @param int|string $field Indicates which column is used in the function. Enter the
 281       *                                        column label enclosed between double quotation marks, such as
 282       *                                        "Age" or "Yield," or a number (without quotation marks) that
 283       *                                        represents the position of the column within the list: 1 for
 284       *                                        the first column, 2 for the second column, and so on.
 285       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 286       *                                        You can use any range for the criteria argument, as long as it
 287       *                                        includes at least one column label and at least one cell below
 288       *                                        the column label in which you specify a condition for the
 289       *                                        column.
 290       *
 291       * @return float|string
 292       */
 293      public static function DSTDEV($database, $field, $criteria)
 294      {
 295          return Database\DStDev::evaluate($database, $field, $criteria);
 296      }
 297  
 298      /**
 299       * DSTDEVP.
 300       *
 301       * Calculates the standard deviation of a population based on the entire population by using the
 302       * numbers in a column of a list or database that match conditions that you specify.
 303       *
 304       * Excel Function:
 305       *        DSTDEVP(database,field,criteria)
 306       *
 307       * @Deprecated 1.17.0
 308       *
 309       * @see Database\DStDevP::evaluate()
 310       *      Use the evaluate() method in the Database\DStDevP class instead
 311       *
 312       * @param mixed[] $database The range of cells that makes up the list or database.
 313       *                                        A database is a list of related data in which rows of related
 314       *                                        information are records, and columns of data are fields. The
 315       *                                        first row of the list contains labels for each column.
 316       * @param int|string $field Indicates which column is used in the function. Enter the
 317       *                                        column label enclosed between double quotation marks, such as
 318       *                                        "Age" or "Yield," or a number (without quotation marks) that
 319       *                                        represents the position of the column within the list: 1 for
 320       *                                        the first column, 2 for the second column, and so on.
 321       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 322       *                                        You can use any range for the criteria argument, as long as it
 323       *                                        includes at least one column label and at least one cell below
 324       *                                        the column label in which you specify a condition for the
 325       *                                        column.
 326       *
 327       * @return float|string
 328       */
 329      public static function DSTDEVP($database, $field, $criteria)
 330      {
 331          return Database\DStDevP::evaluate($database, $field, $criteria);
 332      }
 333  
 334      /**
 335       * DSUM.
 336       *
 337       * Adds the numbers in a column of a list or database that match conditions that you specify.
 338       *
 339       * Excel Function:
 340       *        DSUM(database,field,criteria)
 341       *
 342       * @Deprecated 1.17.0
 343       *
 344       * @see Database\DSum::evaluate()
 345       *      Use the evaluate() method in the Database\DSum class instead
 346       *
 347       * @param mixed[] $database The range of cells that makes up the list or database.
 348       *                                        A database is a list of related data in which rows of related
 349       *                                        information are records, and columns of data are fields. The
 350       *                                        first row of the list contains labels for each column.
 351       * @param int|string $field Indicates which column is used in the function. Enter the
 352       *                                        column label enclosed between double quotation marks, such as
 353       *                                        "Age" or "Yield," or a number (without quotation marks) that
 354       *                                        represents the position of the column within the list: 1 for
 355       *                                        the first column, 2 for the second column, and so on.
 356       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 357       *                                        You can use any range for the criteria argument, as long as it
 358       *                                        includes at least one column label and at least one cell below
 359       *                                        the column label in which you specify a condition for the
 360       *                                        column.
 361       *
 362       * @return float|string
 363       */
 364      public static function DSUM($database, $field, $criteria)
 365      {
 366          return Database\DSum::evaluate($database, $field, $criteria);
 367      }
 368  
 369      /**
 370       * DVAR.
 371       *
 372       * Estimates the variance of a population based on a sample by using the numbers in a column
 373       * of a list or database that match conditions that you specify.
 374       *
 375       * Excel Function:
 376       *        DVAR(database,field,criteria)
 377       *
 378       * @Deprecated 1.17.0
 379       *
 380       * @see Database\DVar::evaluate()
 381       *      Use the evaluate() method in the Database\DVar class instead
 382       *
 383       * @param mixed[] $database The range of cells that makes up the list or database.
 384       *                                        A database is a list of related data in which rows of related
 385       *                                        information are records, and columns of data are fields. The
 386       *                                        first row of the list contains labels for each column.
 387       * @param int|string $field Indicates which column is used in the function. Enter the
 388       *                                        column label enclosed between double quotation marks, such as
 389       *                                        "Age" or "Yield," or a number (without quotation marks) that
 390       *                                        represents the position of the column within the list: 1 for
 391       *                                        the first column, 2 for the second column, and so on.
 392       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 393       *                                        You can use any range for the criteria argument, as long as it
 394       *                                        includes at least one column label and at least one cell below
 395       *                                        the column label in which you specify a condition for the
 396       *                                        column.
 397       *
 398       * @return float|string (string if result is an error)
 399       */
 400      public static function DVAR($database, $field, $criteria)
 401      {
 402          return Database\DVar::evaluate($database, $field, $criteria);
 403      }
 404  
 405      /**
 406       * DVARP.
 407       *
 408       * Calculates the variance of a population based on the entire population by using the numbers
 409       * in a column of a list or database that match conditions that you specify.
 410       *
 411       * Excel Function:
 412       *        DVARP(database,field,criteria)
 413       *
 414       * @Deprecated 1.17.0
 415       *
 416       * @see Database\DVarP::evaluate()
 417       *      Use the evaluate() method in the Database\DVarP class instead
 418       *
 419       * @param mixed[] $database The range of cells that makes up the list or database.
 420       *                                        A database is a list of related data in which rows of related
 421       *                                        information are records, and columns of data are fields. The
 422       *                                        first row of the list contains labels for each column.
 423       * @param int|string $field Indicates which column is used in the function. Enter the
 424       *                                        column label enclosed between double quotation marks, such as
 425       *                                        "Age" or "Yield," or a number (without quotation marks) that
 426       *                                        represents the position of the column within the list: 1 for
 427       *                                        the first column, 2 for the second column, and so on.
 428       * @param mixed[] $criteria The range of cells that contains the conditions you specify.
 429       *                                        You can use any range for the criteria argument, as long as it
 430       *                                        includes at least one column label and at least one cell below
 431       *                                        the column label in which you specify a condition for the
 432       *                                        column.
 433       *
 434       * @return float|string (string if result is an error)
 435       */
 436      public static function DVARP($database, $field, $criteria)
 437      {
 438          return Database\DVarP::evaluate($database, $field, $criteria);
 439      }
 440  }