Source functions

These functions are used to define the source. The list is sorted in alphabetical order. All values are entered in brackets after the function name. The source part in the script must always start with the creator function Creator.createSource().

addDataWithFactor

With this function, data is added from another source. It includes two arguments: 1) A given source to add data from and 2) a factor to multiply all data with. A typical situation is to multiply with +1 or -1 to change a sign to positive and negative.'

Argument: Source and factor.

Example: There are two transactions in source 1: car 2 and bike 3. There are two transactions in source 2: truck 4 and mc 5.

The function is: Source1.addDataWithFactor (Source2,-2) -> Source1 = car -4, bike -6, truck 4 and mc 5.

clearData

This function clears the data of the target.

This is done temporarily during the processing. The source transactions in the database are not cleared by this function.

filterData

This function filters the data in the source or target according to a created filter definition. When using this function, all data that is specified in the filter definition is kept.

Use this function in combination with filter objects. For more information, see Filter objects.

Note that when retrieving data from the database, it is not possible to first select, for example, specified extended dimension 1 members only. First, you load all transactions, and then you create a filter to keep only the transactions you want to continue with. After creating the filter, you apply it on the source or target with the filterData function.

groupByBType

This function replaces a manual journal type in the source with the given manual journal type.

Argument: Manual journal type code.

Source Btype Etype Amount
  Reop   1
  B1   2
  B2 E1 4
Result BT   3
  Bt E1 4

This is done temporarily. The source transactions in the database are not changed by this function. If several transactions have the same manual journal type, and all other dimensions are the same, they are aggregated into one transaction.

groupByClosingVersion

This function replaces the manual journal type in the source with the given closing version.

Argument: Closing version code.

If you select a closing version instead of a manual journal type, the transaction will be in a processing state. When you save the transaction, you need to replace the closing version with a manual journal type again in the target. The source transactions in the database are not changed by this function.

groupByContributionVersion

This function replaces the automatic journal type in the source with the given contribution version.

Argument: Contribution version code.

If you select a contribution version instead of an automatic journal type, the transaction will be in a processing state. When saving the transaction you need to replace the contribution version with an automatic journal type again in the target. The source transactions in the database are not changed by this function.

groupByCounterCompany

This function replaces the counter company in the source with the given counter company.

Argument: Counter company code.

For a more detailed description, see the groupByBType function.

groupByEType

This function replaces the automatic journal type in the source with the given automatic journal type.

Argument: Automatic journal type code.

Source Btype Etype Amount
  Reop   1
  B1   2
  B2 E1 4
Result Repo E2 1
  BT E2 3
  Bt E2 4

For a more detailed description, see the groupByBType function.

groupByExtDim

This function replaces the extended dimension in the source with the given extended dimension.

Argument: Extended dimension number 1-4 and extended dimension code.

For a more detailed description, see the groupByBType function.

groupByJournalNum

This function replaces the journal number in the source with the given journal number.

Argument: Journal number.

groupByOriginCompany

This function replaces the original company in the source with the given original company.

Argument: Company code.

For a more detailed description, see the groupByBType function.

loadData

This function loads the data from the database according to settings.

loadPeriodData

This function loads the periodic data, which will calculate the monthly value.

Use the current month and the previous month to calculate the value for the month. If it is the first month of the year, you do not need to perform any calculation. To find out the first month of the year, use the General configuration via the Period model).

Note: This function does not work for weekly actualities or calculations of quarterly periods.

removeData

This function filters the data in the source or target according to a created filter definition. When using this function, only data that is not included in the filter definition is kept.

Use this function in combination with filter objects. For more information, see Filter objects.

resetPeriod

This function resets the period of the source to the current period. You can use this function if you want to copy a process to another period.

setAccount

This function sets the account for which data should be retrieved in the database.

Argument: Account code.

source.setAccount('P10030')

setBType

This function sets the manual journal type for which data should be retrieved in the database, if the journal type is other than REPO. The default is set by the setClosingVersion value.

Argument: Manual journal type code.

Example: source.setBType('IS')

setClosingVersion

This function sets the closing version for which data should be retrieved in the database. The default is the REPO closing version.

Argument: Manual journal type code.

Example: source.setClosingVersion('IFRS')

setCompany

This function specifies the company for which data should be retrieved in the database. Note that the function retrieves data for one specific company. The default is the current company.

Argument: Company code or an object defined in the script.

Example: source.setCompany('1102')

setCompanyStructure

This function sets the consolidation type to be selected when loading the source. The default is the current structure.

Argument: Consolidation type code or an object defined in the script.

Example: source.setCompanyStructure('LE')

setContributionVersion

This function sets the contribution version for which data should be retrieved in the database. The default is the automatic journal type BASE.

Argument: Automatic journal type code.

Example: source.setContributionVersion('ALL')

setCurrency

This function sets the currency to be selected when loading the source. The default is all currency codes.

Argument: Currency code or an object defined in the script.

Example: source.setCurrency('USD')

setGroup

This function sets the group to be selected when loading the source. The default is current company. The default is the current company.

Argument: Group code.

Example: source.setGroup('1100')

setEType

This function sets the automatic journal type for which data should be retrieved in the database, if the journal type is other than BASE. The default is set by the function setContributionVersion.

Argument: Automatic journal type code.

Example: source.setEType('35')

setExtDim

With the function setExtDim, you create user-defined business rules on specific members of extended dimensions.

This function has the following arguments: number of the extended dimension, specific member of the dimension.

The following example shows the usage of the function setExtDim.

Table 1. Initial situation for the setExtDim example
Account Product Region Dimension 3 Dimension 4 Amount
3020 FR1 5002     100
3020 FR1 5030     50
3020 FR2 5014     200
3020 FR2 5015     150
3020 FR3 5003     100
3020 RE1 5031     50
3020 RE1 5002     200
3020 RE1 5003     300
3020 RE2 5030     200
3020 RE2 5031     1500
If you want to make the calculation on the products FR1 and RE1 in the region 5002, use the following code:
Source1.SetExtDim(1,'FR1')
Source1.SetExtDim(2,'5002')
Source2.SetExtDim(1,'RE1')
Source2.SetExtDim(2,'5002')

The business rule loads 100 for Source1 and 200 for Source2.

If you want to book the result on another dimension named FR4, then the result is as follows:

Table 2. Situation after you book the result on another dimension
Account Product Region Dimension 3 Dimension 4 Amount
3020 FR4 5002     100
3020 FR1 5030     50
3020 FR2 5014     200
3020 FR2 5015     150
3020 FR3 5003     100
3020 RE1 5031     50
3020 FR4 5002     200
3020 RE1 5003     300
3020 RE2 5030     200
3020 RE2 5031     1500

setExtDimAggr

Use the setExtDimAggr function to create user-defined business rules on specific members of extended dimensions and aggregate the result.

This function has the following arguments: number of the extended dimension, specific aggregated member of the dimension.

The following example shows the usage of the function setExtDimAggr.

Table 3. Initial situation for the setExtDimAggr example
Account Product Region Dimension 3 Dimension 4 Amount
3020 FR1 5002     100
3020 FR1 5030     50
3020 FR2 5014     200
3020 FR2 5015     150
3020 FR3 5003     100
3020 RE1 5031     50
3020 RE1 5002     200
3020 RE1 5003     300
3020 RE2 5030     200
3020 RE2 5031     1500
To make the calculation on the aggregated level COMP (products FR1 - FR3) and on the aggregated level 6010 (regions 5002 and 5003), use the following code:
Source1.setExtDimAggr(1, 'COMP')
Source1.setExtDimAggr(2, '6010')

The business rule loads 200 for Source1.

After you book the result on the account 4020 for product FR4 and region 5002 without removing the original transaction, you see the following result:

Table 4. Situation after you book the aggregated result on another dimension
Account Product Region Dimension 3 Dimension 4 Amount
3020 FR4 5002     100
3020 FR1 5030     50
3020 FR2 5014     200
3020 FR2 5015     150
3020 FR3 5003     100
3020 RE1 5031     50
3020 FR4 5002     200
3020 RE1 5003     300
3020 RE2 5030     200
3020 RE2 5031     1500
4020 FR4 5002     200

setJournalNumber

This function sets the journal number for which data should be retrieved in the database. The default is defined by the value of the function setClosgingVersion.

Argument: Journal number.

Example: source.setJournalNumber'0')

setPeract

Use the setPeract function to specify the period and the actuality for which you want the data to be retrieved from the database. If you do not set this parameter, IBM® Controller uses the current period and actuality.

This function has the following arguments: period and actuality code or an object that is defined in the script.

Example: source1.setPeract ('1112AC')

setPeriod

This function specifies the period for which data should be retrieved in the database.

Argument: Period code or an object defined in the script. The default is the current period.

Example: source.setPeriod('1112')

setRelativePeriod

Use the setRelativePeriod function to retrieve data from a period relative to the current period.

The setRelativePeriod function uses the N112 syntax:

  • the default is '+0'
  • Specify the first character as either N, P, +, or -.
  • If you specify the first character as either + or -, add the number of periods relative to current period. For example, if the current period is 1007AC then the relative period +1 is 1008AC.
  • If you specify the first character as either N or P, add the number of years relative to current year and then the period number in that year. For example, if the current period is 1007AC then the relative period N112 is 0912AC.

The following example shows how to calculate the quarterly values with the function setRelativePeriod.

Source1.setPeriod ( currentPeriod )
Source1.loadData ()
Source2. setRelativePeriod ('-3')
Source2. loadData ()
Source1. addDataWithFactor( source2, -1)