Database.php 23 KB

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