Skip to main content

NCR Counterpoint Mapping Functions

Reference for the NCR Counterpoint-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The NCR Counterpoint integration provides ready-made functions you can call when building mappings. They handle common lookups and conversions against your Counterpoint data and your iPaaS.com data, such as converting Counterpoint Y/N fields, deriving a product status, totaling inventory by your location settings, resolving customers, categories, units, and discounts, looking up values from Counterpoint tables, and summarizing timecards, so you do not have to write that logic yourself.

Where you can use these functions

These functions are available anywhere you write a formula for the NCR Counterpoint integration:

  • Dynamic Formula mappings: where a destination field's value is produced by a formula rather than mapped directly from a source field.

  • Mapping collection filters: where a formula decides whether a record should be processed.

  • Error filters: a mapping collection's error filter, which sits alongside its collection filter. When the error filter's formula resolves to true, the transfer raises an error that is held in the Error Logs for review and is not retried automatically.

  • Translation collections: where a translation entry uses a formula as its source value.

How to use them

  • Call a function by name and pass the values it needs in parentheses, for example: await UnitNameFromFlagAsync(ITEM_NO, UNIT_FLG).

  • Each function's signature shows its name, the parameters it accepts (with their types), and the type of value it returns. Use it as the reference for exactly how to call the function.

  • Function names and formula syntax are case-sensitive, so type each name exactly as shown. Whether the values a function matches are treated as case-sensitive varies by function, and is called out in the relevant parameter's description.

  • Some of these functions are asynchronous (their signature returns a Task) and must be called with await; the rest are synchronous and are called directly. Each function's How to call it example shows the correct form.

  • Some functions provide more than one form (overloads): the same function name with different parameter combinations. Pick the form whose inputs you have; each function's Signatures list shows the available forms.

  • Each function runs at sync time, against the data in your connected Counterpoint account and your iPaaS.com subscription.

The functions are grouped below by the area of the integration they support.

Values and status

ConvertCPBool

What it does: Converts a Counterpoint single-character boolean field (Y or N) into a true/false value. A value of N becomes false; anything else becomes true.

Signature: bool ConvertCPBool(object input)

How to call it: ConvertCPBool(input)

Parameter

Type

Required

Default

Description

input

object

Yes

N/A

The Counterpoint field value, expected to be Y or N. Fields whose names start with IS_ (for example IS_ON_SALE) are usually in this format.

Returns: bool. False when the value is N; true otherwise.

Example: ConvertCPBool(IS_TAXBL) returns true unless the value is N.

When to use it: Use it to turn a Counterpoint Y/N field into a true/false value for a destination field.

Status

What it does: Determines the iPaaS.com product status from a Counterpoint item status, its current quantity, and an ecommerce threshold. It returns Inactive or Discontinued from the item status, Out of Stock when the quantity is below the threshold, and Active otherwise.

Signature: string Status(object STAT, object QTY_COMMIT, object ECOMM_THRESHOLD)

How to call it: Status(STAT, QTY_COMMIT, ECOMM_THRESHOLD)

Parameter

Type

Required

Default

Description

STAT

object

Yes

N/A

The Counterpoint item status (I for inactive, D for discontinued).

QTY_COMMIT

object

Yes

N/A

The current quantity to compare against the threshold.

ECOMM_THRESHOLD

object

Yes

N/A

The ecommerce threshold below which the item is treated as out of stock.

Returns: string. One of Inactive, Discontinued, Out of Stock, or Active.

When to use it: Use it to derive a product's iPaaS.com status from its Counterpoint status and stock level.

Items, units, and variants

ItemNumberFromSku

What it does: Extracts the item number portion from a SKU stored in the standard iPaaS.com format, dropping any variant (|) and unit (^) segments.

Signature: string ItemNumberFromSku(string sku)

How to call it: ItemNumberFromSku(sku)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The SKU, in the standard iPaaS.com variant and unit format shown in the example below.

Returns: string. The item number portion of the SKU, or null when the SKU is null.

Example: ItemNumberFromSku("SHIRT|BLUE|RED^3PAK") returns SHIRT.

When to use it: Use it to get the base Counterpoint item number from a full variant or unit SKU.

UnitNameFromFlagAsync

What it does: Returns the name of a Counterpoint item's unit given its unit flag. Flag ! or 0 returns the stocking unit; 1 through 5 return the matching alternate unit.

Signature: Task<string> UnitNameFromFlagAsync(string ITEM_NO, string UNIT_FLG)

How to call it: await UnitNameFromFlagAsync(ITEM_NO, UNIT_FLG)

Parameter

Type

Required

Default

Description

ITEM_NO

string

Yes

N/A

The Counterpoint item number.

UNIT_FLG

string

Yes

N/A

The unit flag: ! or 0 for the stocking unit, or 1 through 5 for an alternate unit.

Returns: string. The unit name for the flag.

When to use it: Use it to turn a Counterpoint unit flag into the unit's name. It raises an error for an unknown item or an invalid flag.

UnitFlagFromNameAsync

What it does: Returns a Counterpoint item's unit flag given the unit name. The stocking unit returns 0, and alternate units return 1 through 5.

Signature: Task<string> UnitFlagFromNameAsync(string ITEM_NO, string UNIT_NAME)

How to call it: await UnitFlagFromNameAsync(ITEM_NO, UNIT_NAME)

Parameter

Type

Required

Default

Description

ITEM_NO

string

Yes

N/A

The Counterpoint item number.

UNIT_NAME

string

Yes

N/A

The unit name to resolve to a flag.

Returns: string. The unit flag (0 for the stocking unit, 1 through 5 for alternate units).

When to use it: Use it to turn a Counterpoint unit name into its unit flag. It raises an error for an unknown item or a unit that does not exist on the item.

GridDimFromSku

What it does: Returns the grid dimension value at the given position from a SKU. When the position has no value, * is returned.

Signature: string GridDimFromSku(string sku, int dimPosition)

How to call it: GridDimFromSku(sku, dimPosition)

Parameter

Type

Required

Default

Description

sku

string

Yes

N/A

The SKU, in the standard iPaaS.com grid-dimension format shown in the example below.

dimPosition

int

Yes

N/A

The grid dimension position to read: 1, 2, or 3.

Returns: string. The dimension value at the position, * when there is none, or null when the SKU is null.

Example: GridDimFromSku("ITEM|Dim1|Dim2|Dim3", 1) returns Dim1.

When to use it: Use it to pull a single grid dimension value out of a variant SKU. It raises an error when the position is not 1, 2, or 3.

CreateGridDimSortOrderJSON

What it does: Builds a JSON string describing the sort order of a gridded Counterpoint item's dimension values. This function is deprecated; variant options are now mapped directly.

Signature: string CreateGridDimSortOrderJSON(string ITEM_NO, string GRID_DIM_1_TAG, string GRID_DIM_2_TAG, string GRID_DIM_3_TAG)

How to call it: CreateGridDimSortOrderJSON(ITEM_NO, GRID_DIM_1_TAG, GRID_DIM_2_TAG, GRID_DIM_3_TAG)

Parameter

Type

Required

Default

Description

ITEM_NO

string

Yes

N/A

The Counterpoint item number.

GRID_DIM_1_TAG

string

Yes

N/A

The tag (name) of the first grid dimension.

GRID_DIM_2_TAG

string

Yes

N/A

The tag of the second grid dimension, if any.

GRID_DIM_3_TAG

string

Yes

N/A

The tag of the third grid dimension, if any.

Returns: string. A JSON string of each dimension's values and their sort order, or null when the item number or first dimension tag is null.

When to use it: This function is deprecated. Map variant options directly instead.

AvailableSerialNumbersAsync

What it does: Returns a comma-separated list of the available (status A) serial numbers for a Counterpoint item at a location.

Signature: Task<String?> AvailableSerialNumbersAsync(string ITEM_NO, string LOC_ID)

How to call it: await AvailableSerialNumbersAsync(ITEM_NO, LOC_ID)

Parameter

Type

Required

Default

Description

ITEM_NO

string

Yes

N/A

The Counterpoint item number.

LOC_ID

string

Yes

N/A

The Counterpoint location ID.

Returns: String?. A comma-separated list of available serial numbers, or null when there are none.

When to use it: Use it to list an item's available serial numbers at a location.

Inventory and cost

QuantityFromSettingsAsync

What it does: Determines an item's quantity from a list of its Counterpoint inventory records, using your subscription's inventory quantity method (a single location, a location group, or all locations). By default it totals the QTY_AVAIL field; an overload lets you choose a different inventory field.

Signatures (pick the form with the inputs you need): - Task<decimal> QuantityFromSettingsAsync(object inventories) - Task<decimal> QuantityFromSettingsAsync(object inventories, string IM_INV_Field) - Task<decimal> QuantityFromSettingsAsync(List<CPHive.DataModels.ItemInventoryCell> inventories)

How to call it: await QuantityFromSettingsAsync(inventories)

Parameter

Type

Required

Default

Description

inventories

object

Yes

N/A

The item's Counterpoint inventory records (a list of inventory records, or a list of inventory cells for the third form).

IM_INV_Field

string

No

N/A

The inventory field to total (for example QTY_ON_HND). Used only by the second form; when omitted, QTY_AVAIL is used.

Returns: decimal. The item quantity determined by your inventory quantity method.

When to use it: Use it to compute an item's quantity according to your inventory settings. It raises an error if no inventory quantity method is set, or if a location or location-group method is used without an inventory location.

AverageCostFromSettings

What it does: Returns an item's average cost at your configured stocking location. You can pass the item number (asynchronous) or a list of the item's Counterpoint inventory records (synchronous).

Signatures (pick the form with the inputs you need): - decimal? AverageCostFromSettings(List<CPHive.DataModels.ItemInventory> inventories) - Task<decimal?> AverageCostFromSettingsAsync(string ITEM_NO)

How to call it: await AverageCostFromSettingsAsync(ITEM_NO)

Parameter

Type

Required

Default

Description

inventories

List<CPHive.DataModels.ItemInventory>

No

N/A

The item's Counterpoint inventory records; used by the synchronous form.

ITEM_NO

string

No

N/A

The Counterpoint item number; used by the asynchronous form.

Returns: decimal?. The average cost at the stocking location, or null when there is no inventory for that location.

When to use it: Use it to read an item's average cost at your stocking location. The item-number form is asynchronous (use await); the inventory-list form is synchronous.

InventoryStockingLocation

What it does: Returns the Counterpoint inventory record for your configured stocking location from a list of an item's inventory records.

Signature: CPHive.DataModels.ItemInventory InventoryStockingLocation(List<CPHive.DataModels.ItemInventory> inventories)

How to call it: InventoryStockingLocation(inventories)

Parameter

Type

Required

Default

Description

inventories

List<CPHive.DataModels.ItemInventory>

Yes

N/A

The item's Counterpoint inventory records.

Returns: CPHive.DataModels.ItemInventory. The inventory record for the stocking location, or null when none matches.

When to use it: Use it to get the stocking-location inventory record, for example to read its on-hand quantity.

Locations

LocationInGroup

What it does: Returns whether a location belongs to a Counterpoint location group.

Signature: bool LocationInGroup(object locationId, object groupId)

How to call it: LocationInGroup(locationId, groupId)

Parameter

Type

Required

Default

Description

locationId

object

Yes

N/A

The Counterpoint location ID to check.

groupId

object

Yes

N/A

The Counterpoint location group ID.

Returns: bool. True when the location is in the group, otherwise false.

Example: LocationInGroup("EAST", "ALL").

When to use it: Use it to test whether a location is part of a location group.

ConvertLocationGroupLocationsToiPaaSLocationListAsync

What it does: Converts a list of Counterpoint location-group locations into the iPaaS.com location list format, resolving each Counterpoint location to its iPaaS.com location ID. Locations that cannot be resolved are skipped.

Signature: Task<List<IPaaSApi.Model.Product.LocationRequest>> ConvertLocationGroupLocationsToiPaaSLocationListAsync(List<CPHive.DataModels.LocationGroupLocation> locations)

How to call it: await ConvertLocationGroupLocationsToiPaaSLocationListAsync(locations)

Parameter

Type

Required

Default

Description

locations

List<CPHive.DataModels.LocationGroupLocation>

Yes

N/A

The Counterpoint location-group locations to convert.

Returns: List<IPaaSApi.Model.Product.LocationRequest>. The iPaaS.com location list, one entry per resolved location.

When to use it: Use it to map a Counterpoint location group's locations to iPaaS.com locations.

Categories

ConvertCategoriesToSpaceportIdsAsync

What it does: Converts a product's Counterpoint ecommerce categories into iPaaS.com category IDs, returning them in the format iPaaS.com expects for category assignments. Categories that cannot be resolved are skipped.

Signature: Task<List<IPaaSApi.Model.Product.GenericRequest>> ConvertCategoriesToSpaceportIdsAsync(List<CPHive.DataModels.EcommerceCategoryAssignment> categories)

How to call it: await ConvertCategoriesToSpaceportIdsAsync(categories)

Parameter

Type

Required

Default

Description

categories

List<CPHive.DataModels.EcommerceCategoryAssignment>

Yes

N/A

The product's Counterpoint ecommerce category assignments.

Returns: List<IPaaSApi.Model.Product.GenericRequest>. The resolved iPaaS.com category IDs as assignment objects.

When to use it: Use it in To iPaaS.com product flows to translate Counterpoint ecommerce categories into iPaaS.com category assignments.

ConvertCustomerCategoriesToiPaaSIdListAsync

What it does: Converts one or more Counterpoint customer category codes into iPaaS.com customer category assignments. You can pass the standard category code and any additional custom category fields.

Signature: Task<List<IPaaSApi.Model.Customer.GenericRequest>> ConvertCustomerCategoriesToiPaaSIdListAsync(params string[] CATEG_CODs)

How to call it: await ConvertCustomerCategoriesToiPaaSIdListAsync(CATEG_COD)

Parameter

Type

Required

Default

Description

CATEG_CODs

string[]

Yes

N/A

One or more Counterpoint customer category names (for example the standard CATEG_COD, plus optional custom category fields).

Returns: List<IPaaSApi.Model.Customer.GenericRequest>. The resolved iPaaS.com customer category assignments.

When to use it: Use it in To iPaaS.com customer flows to translate Counterpoint customer categories into iPaaS.com category assignments.

EcommerceCategoryRootAsync

What it does: Returns the root category ID for a Counterpoint ecommerce category by walking up the parent chain until it reaches a category with no parent. This is useful for filtering categories by their root, for example one root per storefront.

Signature: Task<string> EcommerceCategoryRootAsync(string CATEG_ID, string PARENT_ID)

How to call it: await EcommerceCategoryRootAsync(CATEG_ID, PARENT_ID)

Parameter

Type

Required

Default

Description

CATEG_ID

string

Yes

N/A

The Counterpoint category ID.

PARENT_ID

string

Yes

N/A

The category's parent ID. When empty, the category is treated as its own root.

Returns: string. The root category's ID, or null when the parent chain is broken.

When to use it: Use it to filter your ecommerce category mapping to a specific root category.

Customers

CustomerFromEmailAsync

What it does: Returns the Counterpoint customer number for a given email address. When more than one customer has that address, a customer flagged as an ecommerce customer is preferred.

Signature: Task<string> CustomerFromEmailAsync(string emailAddress)

How to call it: await CustomerFromEmailAsync(emailAddress)

Parameter

Type

Required

Default

Description

emailAddress

string

Yes

N/A

The email address to search for.

Returns: string. The Counterpoint customer number, or null when no customer matches.

When to use it: Use it to resolve a Counterpoint customer number from an email address.

CustomerFromFieldAsync

What it does: Returns the Counterpoint customer number whose specified field matches the given value. When more than one customer matches, a customer flagged as an ecommerce customer is preferred.

Signature: Task<string> CustomerFromFieldAsync(string matchValue, string fieldName)

How to call it: await CustomerFromFieldAsync(matchValue, fieldName)

Parameter

Type

Required

Default

Description

matchValue

string

Yes

N/A

The value to match.

fieldName

string

Yes

N/A

The Counterpoint customer field to match against (for example EMAIL_ADRS_2).

Returns: string. The Counterpoint customer number, or null when no customer matches.

When to use it: Use it to resolve a Counterpoint customer number by matching any customer field.

Transactions, orders, and returns

DocumentSpacePortIdFromDocIdAsync

What it does: Resolves a Counterpoint document ID to its iPaaS.com transaction ID. This bridges the gap where a release ticket does not carry the original document's identifier.

Signature: Task<long?> DocumentSpacePortIdFromDocIdAsync(long? DOC_ID)

How to call it: await DocumentSpacePortIdFromDocIdAsync(DOC_ID)

Parameter

Type

Required

Default

Description

DOC_ID

long?

Yes

N/A

The Counterpoint document ID.

Returns: long?. The iPaaS.com transaction ID, or null when the document ID is not provided or has no match.

When to use it: Use it to find the iPaaS.com transaction for a Counterpoint document, for example when linking a release ticket to its original order.

LineSpacePortIdFromDocIdAsync

What it does: Resolves a Counterpoint document ID and line GUID to the iPaaS.com transaction line ID. This is used when linking a release ticket to the line on its original order.

Signature: Task<string> LineSpacePortIdFromDocIdAsync(long? ORIG_ORD_DOC_ID, Guid? LINK_LIN_GUID)

How to call it: await LineSpacePortIdFromDocIdAsync(ORIG_ORD_DOC_ID, LINK_LIN_GUID)

Parameter

Type

Required

Default

Description

ORIG_ORD_DOC_ID

long?

Yes

N/A

The Counterpoint document ID of the original order.

LINK_LIN_GUID

Guid?

Yes

N/A

The line GUID linking to the original order line.

Returns: string. The iPaaS.com transaction line ID, or null when it cannot be resolved.

When to use it: Use it to link a release ticket's line back to its original order line. It relies on the original order having had its sequence number mapped.

OrderHasReleasedLinesAsync

What it does: Returns whether a Counterpoint order already has released lines.

Signature: Task<bool> OrderHasReleasedLinesAsync(object originalOrder)

How to call it: await OrderHasReleasedLinesAsync(originalOrder)

Parameter

Type

Required

Default

Description

originalOrder

object

Yes

N/A

The original order, as an iPaaS.com transaction.

Returns: bool. True when the order has released lines, otherwise false (including when no order or link is found).

When to use it: Use it to check whether an order has already had lines released before processing a return or release.

LinkLineGuidFromParentAsync

What it does: Finds a Counterpoint release line with enough remaining quantity to return against, for a given original order line and release quantity. It is used during validated returns.

Signature: Task<Guid?> LinkLineGuidFromParentAsync(string lineOriginalOrderId, object originalOrder, decimal releasedQuantity)

How to call it: await LinkLineGuidFromParentAsync(lineOriginalOrderId, originalOrder, releasedQuantity)

Parameter

Type

Required

Default

Description

lineOriginalOrderId

string

Yes

N/A

The iPaaS.com ID of the original order line.

originalOrder

object

Yes

N/A

The original order, as an iPaaS.com transaction.

releasedQuantity

decimal

Yes

N/A

The quantity being returned; the function uses its absolute value.

Returns: Guid?. The GUID of a matching release line.

When to use it: Use it during validated returns to find the release line to return against. It raises an error if no suitable release line can be found.

DiscountIdFromCode

What it does: Returns the Counterpoint discount ID for a given discount code.

Signature: Task<String?> DiscountIdFromCode(string DISC_COD)

How to call it: await DiscountIdFromCode(DISC_COD)

Parameter

Type

Required

Default

Description

DISC_COD

string

Yes

N/A

The Counterpoint discount code.

Returns: String?. The discount ID, or null when no discount matches the code.

When to use it: Use it to resolve a Counterpoint discount ID from a discount code.

Table lookups and child mapping

TableEntryAsync

What it does: Returns the first row of a Counterpoint table where a field matches a value, as a dictionary of that row's field values.

Signature: Task<Dictionary<string, object>> TableEntryAsync(string tableName, string filterField, object filterValue)

How to call it: await TableEntryAsync(tableName, filterField, filterValue)

Parameter

Type

Required

Default

Description

tableName

string

Yes

N/A

The Counterpoint table to read (for example PO_VEND).

filterField

string

Yes

N/A

The field to match on (for example VEND_NO).

filterValue

object

Yes

N/A

The value the field must equal.

Returns: Dictionary<string, object>. The first matching row's fields, or null when there is no match.

Example: await TableEntryAsync("PO_VEND", "VEND_NO", ITEM_VEND_NO).

When to use it: Use it to pull a whole row from a Counterpoint table for a matched key.

ValueFromLookupTableAsync

What it does: Returns a single field's value from the first matching row of a Counterpoint table. You can match on one field and value, or on a dictionary of several field matches.

Signatures (pick the form with the inputs you need): - Task<object> ValueFromLookupTableAsync(Dictionary<string, string> dictionaryMatches, string lookupTableName, string returnFieldName) - Task<object> ValueFromLookupTableAsync(object sourceValue, string lookupTableName, string lookupFieldName, string returnFieldName)

How to call it: await ValueFromLookupTableAsync(dictionaryMatches, lookupTableName, returnFieldName)

Parameter

Type

Required

Default

Description

dictionaryMatches

Dictionary<string, string>

No

N/A

A set of field/value matches to filter on; used by the multi-field form.

lookupTableName

string

Yes

N/A

The Counterpoint table to read (for example PO_VEND).

returnFieldName

string

Yes

N/A

The field whose value to return (for example NAM).

sourceValue

object

No

N/A

The value to match; used by the single-field form.

lookupFieldName

string

No

N/A

The field to match sourceValue against (for example VEND_NO); used by the single-field form.

Returns: object. The value of the return field from the first matching row, or null when there is no match.

Example: await ValueFromLookupTableAsync(ITEM_VEND_NO, "PO_VEND", "VEND_NO", "NAM") returns a vendor name for an item's vendor number.

When to use it: Use it to look up a single Counterpoint field value, for example a vendor name from a vendor number. It raises an error if the return field does not exist in the table.

ChildMapAsync

What it does: Returns a stringified dictionary of a specified field's value for each child item of a parent item. Children are Counterpoint items whose USR_PAR_ITEM_NO matches the parent.

Signature: Task<string> ChildMapAsync(string parentItemNumber, string childFieldName)

How to call it: await ChildMapAsync(parentItemNumber, childFieldName)

Parameter

Type

Required

Default

Description

parentItemNumber

string

Yes

N/A

The Counterpoint parent item number.

childFieldName

string

Yes

N/A

The Counterpoint item field to read from each child (for example ALT_1_PRC_1).

Returns: string. A semicolon-separated list of childSku, value entries, or null when there are no children.

When to use it: Use it to collect a field from all of a parent item's children into a single string, for example to store on a custom field. It raises an error if the field does not exist on the item table.

ChildMapTableLookupAsync

What it does: Like ChildMapAsync, but resolves each child item's value through a table lookup that can match on several fields. An optional secondary lookup can supply a fallback value, which is useful for pricing.

Signature: Task<string> ChildMapTableLookupAsync(string parentItemNumber, Dictionary<string, string> dictionaryMatches, string lookupTableName, string returnFieldName, Dictionary<string, string>? secondaryMatches, string? secondaryTableName, string? secondaryFieldName)

How to call it: await ChildMapTableLookupAsync(parentItemNumber, dictionaryMatches, lookupTableName, returnFieldName, secondaryMatches, secondaryTableName, secondaryFieldName)

Parameter

Type

Required

Default

Description

parentItemNumber

string

Yes

N/A

The Counterpoint parent item number.

dictionaryMatches

Dictionary<string, string>

Yes

N/A

The field/value matches for the lookup. Each child's item number is added automatically.

lookupTableName

string

Yes

N/A

The Counterpoint table to look up each child in.

returnFieldName

string

Yes

N/A

The field whose value to return from the lookup table.

secondaryMatches

Dictionary<string, string>?

Yes

N/A

The field/value matches for an optional fallback lookup; pass null to skip it.

secondaryTableName

string?

Yes

N/A

The table for the fallback lookup; required when secondaryMatches is provided, otherwise pass null.

secondaryFieldName

string?

Yes

N/A

The field to return from the fallback lookup; required when secondaryMatches is provided, otherwise pass null.

Returns: string. A semicolon-separated list of childSku, value entries, or null when there are no children.

When to use it: Use it to build a child-item map where each value comes from a multi-field table lookup, with an optional fallback value. It raises an error if required inputs are missing or a field does not exist.

VariantMapTableLookupAsync

What it does: Like ChildMapTableLookupAsync, but maps each variant of a parent item. It builds each variant's full SKU from its grid dimensions and resolves values through a table lookup that can match on several fields, with an optional fallback lookup.

Signature: Task<string> VariantMapTableLookupAsync(string parentItemNumber, Dictionary<string, string> dictionaryMatches, string lookupTableName, string returnFieldName, Dictionary<string, string>? secondaryMatches, string? secondaryTableName, string? secondaryFieldName)

How to call it: await VariantMapTableLookupAsync(parentItemNumber, dictionaryMatches, lookupTableName, returnFieldName, secondaryMatches, secondaryTableName, secondaryFieldName)

Parameter

Type

Required

Default

Description

parentItemNumber

string

Yes

N/A

The Counterpoint parent item number.

dictionaryMatches

Dictionary<string, string>

Yes

N/A

The field/value matches for the lookup. Each variant's item number and grid dimensions are added automatically.

lookupTableName

string

Yes

N/A

The Counterpoint table to look up each variant in.

returnFieldName

string

Yes

N/A

The field whose value to return from the lookup table.

secondaryMatches

Dictionary<string, string>?

Yes

N/A

The field/value matches for an optional fallback lookup; pass null to skip it.

secondaryTableName

string?

Yes

N/A

The table for the fallback lookup; required when secondaryMatches is provided, otherwise pass null.

secondaryFieldName

string?

Yes

N/A

The field to return from the fallback lookup; required when secondaryMatches is provided, otherwise pass null.

Returns: string. A semicolon-separated list of variantSku, value entries, or null when there are no variants.

When to use it: Use it to build a variant map where each value comes from a multi-field table lookup, with an optional fallback value.

Custom fields

GetCustomField_CPHive

What it does: Returns the value of a named custom field from a custom-field collection, or from an object that has custom fields. It returns null when the field is not present.

Signature: object GetCustomField_CPHive(object inputObject, string propertyName)

How to call it: GetCustomField_CPHive(inputObject, propertyName)

Parameter

Type

Required

Default

Description

inputObject

object

Yes

N/A

The custom-field collection, or an object that contains custom fields.

propertyName

string

Yes

N/A

The name of the custom field to read.

Returns: object. The custom field's value, or null when the field is not found.

When to use it: Use it to pull a named custom field value into a destination field. It raises an error if the object does not expose custom fields.

Timecards

TimecardStartDTFromLines

What it does: Returns the earliest clock-in time across a timecard's non-void lines.

Signature: DateTime TimecardStartDTFromLines(List<TimecardLine> lines)

How to call it: TimecardStartDTFromLines(lines)

Parameter

Type

Required

Default

Description

lines

List<TimecardLine>

Yes

N/A

The timecard lines to evaluate. Only non-void lines are considered.

Returns: DateTime. The earliest clock-in time across the non-void lines; the minimum date value when there are no lines.

When to use it: Use it to get a timecard's start time from its lines.

TimecardEndDTFromLines

What it does: Returns the latest clock-out time across a timecard's non-void lines.

Signature: DateTime TimecardEndDTFromLines(List<TimecardLine> lines)

How to call it: TimecardEndDTFromLines(lines)

Parameter

Type

Required

Default

Description

lines

List<TimecardLine>

Yes

N/A

The timecard lines to evaluate. Only non-void lines are considered.

Returns: DateTime. The latest clock-out time across the non-void lines; the maximum date value when there are no lines.

When to use it: Use it to get a timecard's end time from its lines.

TimecardTotalHoursFromLines

What it does: Returns the total worked hours across a timecard's non-void lines, summing the difference between clock-out and clock-in on each line that has both, rounded to three decimal places.

Signature: decimal TimecardTotalHoursFromLines(List<TimecardLine> lines)

How to call it: TimecardTotalHoursFromLines(lines)

Parameter

Type

Required

Default

Description

lines

List<TimecardLine>

Yes

N/A

The timecard lines to total. Only non-void lines with both a clock-in and a clock-out are counted.

Returns: decimal. The total worked hours, rounded to three decimal places; 0 when there are no lines.

When to use it: Use it to compute the total hours on a timecard from its lines.

Related Documents

Did this answer your question?