Functions Data

UpdateCodes

The UpdateCodes() function updates the codes for specified entities and code types in the Quintessence database.

  • If the specified code type already exists for the entity, its code is updated.
  • If the code type does not exist for the entity, the code type and code are added.
  • If multiple codes exist for the same code type, the default code in the database is updated.

Related functions: UpdateRelationship, UpdateRelationshipData, UpdateTimeseries, UpdateTradingDays


Syntax:

Qx.UpdateCodes(Entities, Code Types, Codes, [ShowError])
  • In Excel with Quintessence add-in versions prior to 25.1, use: UpdateCodes()
 See parameter descriptions

EntitiesThe entities to update.
Code TypesThe code types to update.
CodesThe replacement codes.
ShowError
(optional)
If set to TRUE, an error message will be displayed if the function fails.

Remarks:

  • Unless changed by the administrator, default parameter values are:
    • ShowError: TRUE

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Add a new entity code and code type to an existing entity


Current data in the database:

EntityCodeCode TypeDefault
VRRVRRStockExchange1 Alpha CodeY

A new entity code,100U, with code type TradableInstrument1 must be added to the existing entity VRR.

Formula:

=Qx.UpdateCodes("VRR", "TradableInstrument1", "100U", TRUE)

After clicking Upload Selected or Upload Sheet, the database will contain:

EntityCodeCode TypeDefault
VRRVRRStockExchange1 Alpha CodeY
100UTradableInstrument1Y
> Example 2: Update an existing code and code type


Current data in the database:

EntityCodeCode TypeDefault
VRRVRRStockExchange1 Alpha CodeY
100UTradableInstrument1Y
100U_1TradableInstrument1N

The default code for TradableInstrument1 on entity VRR must be updated to 100U_0.

Formula:

=Qx.UpdateCodes("VRR", "TradableInstrument1", "100U_0", TRUE)

After clicking Upload Selected or Upload Sheet, the database will contain:

EntityCodeCode TypeDefault
VRRVRRStockExchange1 Alpha CodeY
100U_0TradableInstrument1Y
100U_1TradableInstrument1N