List dimension types
Lists the dimension types of the company with their code mask and levels, or only those of one financial level.
dimensionTypes()->search() searches them with the Finder (type DMT). Each result is a DimensionTypeSummary with code and name; get() reads the whole type (see Read dimension type).
The search can be narrowed with two dimension type options:
financialLevel(2): only the types of that financial level, e.g.CRD,DEBandKPL.ofDimension('1000'): only the types that have a dimension with that code, e.g.BASandDEB.
This example reads every type, one request each. Twinfield limits the number of requests per second; on HTTP 429 you get a RateLimitExceededException (see Error handling).
$twinfield = Example::twinfield();$types = $twinfield->dimensionTypes();
// A financial level from the command line, e.g. `2`, or else all dimension types.$search = isset($argv[1]) ? $types->search()->financialLevel((int) $argv[1]) : $types->search();
printf('%-4s %-20s %-24s %s' . PHP_EOL, 'Code', 'Name', 'Mask', 'Levels (financial, time)');
foreach ($search->all() as $summary) { $type = $types->get($summary->code);
printf( '%-4s %-20s %-24s %d, %d' . PHP_EOL, $type->code, $type->name, $type->mask, $type->levels->financial, $type->levels->time, );}php examples/dimension-types/list-dimension-types/example.phpphp examples/dimension-types/list-dimension-types/example.php 2Code Name Mask Levels (financial, time)ACT Activiteiten A[0-9][0-9][0-9] 4, 2AST Vaste activa 6[0-9][0-9][0-9][0-9] 3, 0BAS Balans * 1, 0CRD Crediteuren 2[0-9][0-9][0-9] 2, 0DEB Debiteuren 1[0-9][0-9][0-9] 2, 0KPL Kostenplaatsen * 2, 0PNL Winst & verlies * 1, 0PRJ Projecten P[0-9][0-9][0-9][0-9] 3, 1Source
Section titled “Source”View examples/dimension-types/list-dimension-types/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.