Skip to content

Trc_Db_GetTableValue

Gets a value from a database table.

Function Parameters

Parameter 1

Table of the connected database. E.g. Sales.

Parameter 2

Value field of the table. E.g. Amount.

Parameter 3

Aggregation of the records. E.g. SUM.

AggregationDescription
AverageBuilds the avererage of the records.
CountCounts the records.
MaxBuilds the max of the records.
MinBuilds the min of the records.
SumBuilds the sum of the records.

Parameter 4..n

Filter value pairs. The first value contains the dimension, the second value contains an item of the dimension. E.g. Region and North.

It is also possible to use the filters of a workspace. In this case the first value contains the keyword <<Filter>>. The second value is a pair of to values, separated by an equal sign. The first part describes the workspace and the second part contains the name of the filter.

E.g. this sample uses the filter FilterYear of the Sales workspace.

"<<Filter>>";"Sales=FilterYear"

Samples

Builds the amount sum of the region North.

=TRC_DB_GETTABLEVALUE("Sales";"Amount";"SUM";"Region";"North")

Builds the amount sum of the region North and the year values set in the FilterYear filter of the workspace Sales.

=TRC_DB_GETTABLEVALUE("Sales";"Amount";"SUM";"Region";"North";"<<Filter>>";"Sales=FilterYear")

Builds the turnover sum of the regions North and South.

=TRC_DB_GETTABLEVALUE("Sales";"TurnoverTotal";"SUM";"Region";"North";"Region";"South")

Builds the turonover max of the region North with key accounter Bob.

=TRC_DB_GETTABLEVALUE("Sales";"TurnoverTotal";"MAX";"Region";"North";"KeyAccounter";"Bob")

References are used in the filters of cell C5. sample

Assistant Window

The assistant window can be used to generate a funtion.

1. Table

Selects a table of the connected database.

table

2. Value

A value field must be selected.

value

3. Filter Items

It is possible to retrieve only parts of the data from the table. Therefore filter items are used. This page shows the dimensions of the selected table.

filter-items

Selected
If a dimension is enabled, it is used to filter the data of the table.

Item
Item of the dimension, to filter the table data.

4. Workspace Filter

It is also possible to use the filters of a workspace. In the left area, the user must select a workspace. In the right area the filters of the selected workspace are displayed.

filter

5. Aggregation

Not only sums can be loaded, but also min, max, average or count.

aggregation

6. Finish

After finish the function is placed in the selected cell of the worksheet.

=TRC_DB_GETTABLEVALUE("Sales";"Amount";"SUM";"Region";"North";"<<Filter>>";"Sales=FilterYear")