Target functions

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

addDataWithFactor

With this function, data is added from a source. It includes two commands: 1) Add data from a given source 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 or negative.

Argument: Source function and factor.

addSingleValue

This function adds a given value to the target.

Example: Target.addSingleValue ('car',' ',' ',' ') results in a new account with ext.dim1 = 'car'

clearData

This function clears the data of the target.

divideByTarget

This function specifies what the target should be divided by.

Argument: Source function and source function, or target function and target function.

Example: divideByTarget (Source) means that the target is divided by the source.

The numerator and denominator need to be specified in the same way, that is, the same extended dimension 1, extended dimension 2, and so on. Transactions that do not match will not be included.

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.

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 enters the manual journal type in the target with the given manual journal type.

Argument: Manual journal type code.

groupByCounterCompany

This function enters the counter company in the target with the given counter company.

Argument: Counter company code.

groupByEType

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

Argument: Automatic journal type code.

groupByExtDim

This function enters the extended dimension in the target with the given extended dimension.

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

groupByJournalNum

This function enters the journal number in the target with the given journal number.

Argument: Journal number.

groupByOriginCompany

This function enters the original company in the target with the given original company.

Argument: Company code.

mergeAndSaveData

This function compares what is already in the database and the target, adds the difference (merge) and saves the total in the database.

A summation is done if there is a transaction in both the database and the target. If there is a transaction in the database that do not exist in the target, the transaction in the database will be deleted.

multiplyByConstant

With this function, all amounts will be multiplied with the given constant.

Example: mulitplyByConstant(100) will result in amounts 100 times higher.

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.

resetExtDim

With this function, the previously specified extended dimension member is reset.

Argument: Extended dimension number 1-4 number.

saveData

With this function, saving is performed without considering what is included in the database before saving. Note that this means that there is a risk of double transactions in the database.

saveDataWithJournalHeaders

This function saves the data and generates relevant journal headers for the database table.

setAccount

This function specifies the account where data should be stored in the database. The default is source account code.

Argument: Account code.

Example: source.setAccount('S12080')

setAmountToConstant

This function sets the amounts in the target to the specified constant. The default is the source value.

Example: target.setAmountToConstant(100)

setBType

This function specifies the manual journal type where data should be stored in the database. The default is the source Btype.

Argument: Manual journal type code.

Example: target.setBType('IS')

setCompany

This function specifies the company to be used when saving the target. The default is the source company code.

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

Example: target.setCompany('1102')

setCompanyStructure

This function specifies the consolidation type to be used when saving the target. The default is the source company structure.

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

Example: target.setCompanyStructure('LE')

setCurrency

This function specifies the currency to be used when saving the target. The default is the source currency.

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

Example: target.setCurrency('USD')

setEType

This function specifies the automatic journal type where data should be stored in the database. The default is the source Etype.

Argument: Automatic journal type code.

Example: target.setEType('35')

setExtDim

This function specifies the extended dimension 1 member on which the target amounts should be saved. This function replaces the original extended dimension 1 member. The default is the source dimension.

It is possible to include several setExtDim1 functions, without having to reset the extended dimension 1. The level of the given extended dimension 1 member must comply with the level definition of the account.

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

Example: target.setExtDim1('USA')target.setExtDim2('1020')target.setExtDim3('XXXX')target.setExtDim4('YYYY')source.setCompanyStructure('LE')

setGroup

This function specifies the group to be used when saving the target. The default is the source groupe code.

Argument: Group code.

Example: target.setGroup('1100')

setJournalNumber

This function specifies the journal number where data should be stored in the database. The default is the source journal number.

Argument: Journal number.

Example: target.setJournalNumber('0')

setPeriod

This function specifies the period to be used when saving the target. The default is the current period.

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

Example: source.setPeriod('1112')

setTransferAmount

This function will store the result in the transaction amount field.

Example: target.setTransferAmount('')

setTransferCurrency

This function specifies the transaction currency for the target amounts.

Argument: Currency code.

Example: target.setTransferCurrency('USD')