Menu

## Lookup
in package

Lookup.php : 14

A lookup is a calculated field with values from other tables or fixed values

### Table of Contents

BTNCLASSES = ['default', 'primary', 'info', 'success', 'danger', 'warning', 'accent']
VALUETYPES = ['lookup', 'lookup-all', 'const', 'count', 'sum']
$btnClass : mixed
$cardPage : mixed
$drillDownLink : mixed
$drillDownTarget : mixed
$enabled : mixed
$faIcon : mixed
$fieldname : mixed
$filterDefinitions : array<string|int, FilterDefinition>
$label : mixed
$lookupAllSeparator : mixed
$onCard : mixed
$onList : mixed
$onUpdate : mixed
$pageId : mixed
$position : mixed
$tableFieldname : mixed
$value : mixed
$valueType : mixed
$visible : mixed
$overrideDrillDownLink : mixed
$table : TableDescriptor
__construct() : Lookup
  Creates a Lookup
addFilterDefinitiona() : Lookup
  Add a filter definitinon for the reference table
calculateLookup() : void
  Calculates the values of the lookup field
getDrillDownLink() : string
  Gets the link for the related page (card or list)
setBtnClass() : mixed
  Defines the button appearance.
setCardPage() : Lookup
  Set if the drilldown Page is a cardpage
setDrillDownLink() : Lookup
  Set the drilldown link maunally
setDrillDownTarget() : Lookup
  Set the target for the drilldown link (_blank, _self, _parent, _top). Default is _self
setEnabled() : Lookup
  Enableds/disables the action
setFaIcon() : Lookup
  Sets the icon for the button (font awesome icon name)
setFieldname() : Lookup
  Set reference fieldname for $position
setLabel() : Lookup
  Set the label of the action/lookup on pages
setLookupAllSeparator() : Lookup
  Set the separator string for $valueType
setOnCard() : Lookup
  Show/hide on card pages.
setOnList() : Lookup
  Show/hide on list pages.
setOnUpdate() : Lookup
  Show/hides on update pages.
setPageId() : Lookup
  Set the drilldown pageId
setPosition() : Lookup
  Set the position of the lookup 'before-field', 'after-field', 'to-field'
setTable() : Lookup
  Set the reference table
setTableFieldname() : Lookup
  Set the fieldname of the reference table (for lookup)
setValue() : Lookup
  Set the value of the action/lookup on pages
setValueType() : Lookup
  Set the value type lookup', 'lookup-all', 'const', 'count', 'sum'
setVisible() : Lookup
  Show/hide.

### Constants

#### BTNCLASSES

Lookup.php : 19
`public mixed BTNCLASSES = ['default', 'primary', 'info', 'success', 'danger', 'warning', 'accent']`

#### VALUETYPES

Lookup.php : 18
`public mixed VALUETYPES = ['lookup', 'lookup-all', 'const', 'count', 'sum']`

### Properties

#### $btnClass

Lookup.php : 27
`public mixed $btnClass = 'default'`

#### $cardPage

Lookup.php : 36
`public mixed $cardPage = false`

#### $drillDownLink

Lookup.php : 40
`public mixed $drillDownLink = ''`

#### $drillDownTarget

Lookup.php : 42
`public mixed $drillDownTarget = '_self'`

#### $enabled

Lookup.php : 30
`public mixed $enabled = true`

#### $faIcon

Lookup.php : 26
`public mixed $faIcon = ''`

#### $fieldname

Lookup.php : 29
`public mixed $fieldname = ''`

#### $filterDefinitions

Lookup.php : 38
`public array<string|int, FilterDefinition> $filterDefinitions = []`

fitlers for the reference talbe

#### $label

Lookup.php : 22
`public mixed $label = ''`

#### $lookupAllSeparator

Lookup.php : 43
`public mixed $lookupAllSeparator = ', '`

#### $onCard

Lookup.php : 24
`public mixed $onCard = true`

#### $onList

Lookup.php : 23
`public mixed $onList = true`

#### $onUpdate

Lookup.php : 25
`public mixed $onUpdate = true`

#### $pageId

Lookup.php : 35
`public mixed $pageId = ''`

#### $position

Lookup.php : 28
`public mixed $position = ''`

#### $tableFieldname

Lookup.php : 34
`public mixed $tableFieldname = ''`

#### $value

Lookup.php : 21
`public mixed $value = ''`

#### $valueType

Lookup.php : 39
`public mixed $valueType = 'lookup'`

#### $visible

Lookup.php : 31
`public mixed $visible = true`

#### $overrideDrillDownLink

Lookup.php : 41
`private mixed $overrideDrillDownLink = false`

#### $table

Lookup.php : 33
`private TableDescriptor $table = null`

the reference table for the lookup

### Methods

#### __construct()

Lookup.php : 67

Creates a Lookup

`public __construct(TableDescriptor $table, string $tableFieldname, array<string|int, mixed> $filterDefinitions, string $valueType, string $label, string $position, string $fieldname[, string $pageId = '' ][, bool $cardPage = false ][, string $value = '' ]) : Lookup`

##### Parameters

$table : TableDescriptor

  the reference table for the lookup

$tableFieldname : string

  the fieldname in the recerence table

$filterDefinitions : array<string|int, mixed>

  fitlers for the reference talbe

$valueType : string

  Defines which value(s) the lookup should fetch from the related table´s column:

  - 'lookup': fetches the value of $tableFieldname from a single record: typically used when the filters result in a single record
  - 'lookup-all': fetches the values of $tableFieldname from multiple records and glues them together with $lookupAllSeparator: typically used when the filters result in multiple records
  - 'const': fetches a constant value defined by $value: makes sense if you dont want to show data from another table, but to crate some sort of link to it
  - 'count': fetches records from the other table and counts them
  - 'sum': fetches the values of $tableFieldname from multiple records sums them up: typically used when creating totals. Requires $tableFieldname to be a numeric field.
$label : string

  The text of the label for this Lookup

$position : string

  Position on card page. 'before-field', 'after-field', 'to-field'

$fieldname : string

  The reference field for $position

$pageId : string = ''
$cardPage : bool = false

  Shows the related record in a card page (fitlers have to return exactly one record!)

$value : string = ''

  The value for $valueType 'const'

##### Tags

stackable

##### Return values

Lookup —

#### addFilterDefinitiona()

Lookup.php : 317

Add a filter definitinon for the reference table

`public addFilterDefinitiona(FilterDefinition $filterDefinition) : Lookup`

##### Parameters

$filterDefinition : FilterDefinition

##### Return values

Lookup —

#### calculateLookup()

Lookup.php : 100

Calculates the values of the lookup field

`public calculateLookup(array<string|int, mixed> $record[, bool $calculateLink = true ]) : void`

##### Parameters

$record : array<string|int, mixed>

  The source record

$calculateLink : bool = true

##### Return values

void —

#### getDrillDownLink()

Lookup.php : 174

Gets the link for the related page (card or list)

`public getDrillDownLink(array<string|int, mixed> $record) : string`

##### Parameters

$record : array<string|int, mixed>

  The reference record

##### Return values

string —

#### setBtnClass()

Lookup.php : 250

Defines the button appearance.

`public setBtnClass([string $btnClass = 'default' ]) : mixed`

Admin LTE button type. ''|'default'|'primary'|'info'|'success'|'danger'|'warning'|'accent'

##### Parameters

$btnClass : string = 'default'

##### Tags

stackable

##### Return values

mixed —

#### setCardPage()

Lookup.php : 311

Set if the drilldown Page is a cardpage

`public setCardPage(bool $cardPage) : Lookup`

##### Parameters

$cardPage : bool

##### Return values

Lookup —

#### setDrillDownLink()

Lookup.php : 337

Set the drilldown link maunally

`public setDrillDownLink(string $drillDownLink[, bool $override = true ]) : Lookup`

##### Parameters

$drillDownLink : string
$override : bool = true

  If this is set to true, the lookup will always take the link you provide instead of calculating one base on the table and filters

##### Return values

Lookup —

#### setDrillDownTarget()

Lookup.php : 329

Set the target for the drilldown link (_blank, _self, _parent, _top). Default is _self

`public setDrillDownTarget(string $drillDownTarget) : Lookup`

##### Parameters

$drillDownTarget : string

##### Return values

Lookup —

#### setEnabled()

Lookup.php : 273

Enableds/disables the action

`public setEnabled([bool $enabled = true ]) : Lookup`

##### Parameters

$enabled : bool = true

##### Tags

stackable

##### Return values

Lookup —

#### setFaIcon()

Lookup.php : 242

Sets the icon for the button (font awesome icon name)

`public setFaIcon(string $faIcon) : Lookup`

##### Parameters

$faIcon : string

##### Return values

Lookup —

#### setFieldname()

Lookup.php : 265

Set reference fieldname for $position

`public setFieldname(string $fieldname) : Lookup`

##### Parameters

$fieldname : string

##### Return values

Lookup —

#### setLabel()

Lookup.php : 218

Set the label of the action/lookup on pages

`public setLabel(string $label) : Lookup`

##### Parameters

$label : string

##### Return values

Lookup —

#### setLookupAllSeparator()

Lookup.php : 343

Set the separator string for $valueType

`public setLookupAllSeparator(string $lookupAllSeparator) : Lookup`

##### Parameters

$lookupAllSeparator : string

##### Return values

Lookup —

#### setOnCard()

Lookup.php : 230

Show/hide on card pages.

`public setOnCard([bool $onCard = true ]) : Lookup`

##### Parameters

$onCard : bool = true

##### Return values

Lookup —

#### setOnList()

Lookup.php : 224

Show/hide on list pages.

`public setOnList([bool $onList = true ]) : Lookup`

##### Parameters

$onList : bool = true

##### Return values

Lookup —

#### setOnUpdate()

Lookup.php : 236

Show/hides on update pages.

`public setOnUpdate([bool $onUpdate = true ]) : Lookup`

##### Parameters

$onUpdate : bool = true

##### Return values

Lookup —

#### setPageId()

Lookup.php : 305

Set the drilldown pageId

`public setPageId(string $pageId) : Lookup`

##### Parameters

$pageId : string

##### Return values

Lookup —

#### setPosition()

Lookup.php : 299

Set the position of the lookup 'before-field', 'after-field', 'to-field'

`public setPosition(string $position) : Lookup`

##### Parameters

$position : string

##### Return values

Lookup —

#### setTable()

Lookup.php : 286

Set the reference table

`public setTable(TableDescriptor $table) : Lookup`

##### Parameters

$table : TableDescriptor

##### Return values

Lookup —

#### setTableFieldname()

Lookup.php : 292

Set the fieldname of the reference table (for lookup)

`public setTableFieldname(string $tableFieldname) : Lookup`

##### Parameters

$tableFieldname : string

##### Return values

Lookup —

#### setValue()

Lookup.php : 212

Set the value of the action/lookup on pages

`public setValue(string $value) : Lookup`

##### Parameters

$value : string

##### Return values

Lookup —

#### setValueType()

Lookup.php : 323

Set the value type lookup', 'lookup-all', 'const', 'count', 'sum'

`public setValueType(string $valueType) : Lookup`

##### Parameters

$valueType : string

##### Return values

Lookup —

#### setVisible()

Lookup.php : 280

Show/hide.

`public setVisible([bool $visible = true ]) : Lookup`

##### Parameters

$visible : bool = true

##### Tags

stackable

##### Return values

Lookup —

## Search results