Criterias

Table of Contents

What are criterias?

Criterias are a way of dynamically configuring and telling the Lionbridge translation integration when a source or target language should be used for a given entity, when using the automated translation sender.

You can set up one or more criterias for a language configuration that each translatable entity will need to fulfill in order to use that source/target language.

A language can only contain one criteria element, this can however be a CompoundCriteria, which is a way of grouping multiple criterias, so that you can check for multiple conditions. More information about the CompoundCriteria can be found below.

inRiver example data model

This is the inRiver data model we will be using in our examples

FieldCriteria

Verifies a specific field on an entity fulfills various conditions.

Properties

Name

Required

Property type

Value type

FieldType

Yes

Attribute

string

Operator

Yes

Attribute

Enum - Operator

ApplyToPreviousRevision

No

Attribute

Boolean

Language

Variable

Attribute

string

Value

Yes

Attribute

string

FieldType

Field type id of an existing field in PIM.

If the field's data type is LocaleString, the Language attribute is required.

If the field's data type is CVL, and the Operator is either Equals, or NotEquals, then a cvl value with the provided cvl key must exist.

Operator

  • Equals

    • Verify that the field value equals the provided value.

  • NotEquals

    • Verify that the field value does not equals the provided value.

  • Empty

    • Verify that the field value is empty.

  • NotEmpty

    • Verify that the field value is not empty

  • Contains

    • If the field is of type CVL and a multivalue, it will verify that the field contains the provided CVL value key. Otherwise it will verify that the field value contains the provided value.

  • NotContains

    • If the field is of type CVL and a multivalue, it will verify that the field does not contain the provided CVL value key. Otherwise it will verify that the field does not contain the provided value.

ApplyToPreviousRevision

Determines whether or not the verification should apply to the previous revision of the field (How it was before it was last modified).

Language

InRiver language code to use for LocaleString fields.

Value

The field value to verify against

Examples

Example - Verify Field "ProductMarket" contains the value "SE"

ProductMarket is a multivalue CVL field that indicates which market the product is available in.

<FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" />

LinkCriteria

Verifies various entity link conditions

Properties

Name

Required

Property Type

Value type

LinkType

Yes

Attribute

string

LinkDirection

Yes

Attribute

Enum - LinkDirection

Operator

Yes

Attribute

Enum - LinkOperator

Number

No

Attribute

Int32

No

Element

Criteria

LinkType

Link type id of an existing link type in PIM

LinkDirection

The type of link to match

  • OutBound

    • Check for outbound links

  • InBound

    • Check for inbound links

Operator

The type of operation

  • LinkExists

    • Verify that at least one link exists

  • NoLinkExists

    • Verify that no link exists

  • MinimumNumberOfLinksExists

    • Verify that at least X amount of links exists, where X is the value present in the Number attribute.

Number

Used to verify number of links when the Operator is "MinimumNumberOfLinksExists"

Note: If a sub-criteria was provided, links will be filtered away where the entity on the other end of the link does not match the sub-criteria, before the amount of links is verified.

Value

Optional sub-criteria that needs to be met for the entity on the other end of each link.

Examples

<LinkCriteria LinkType="ProductItems" Operator="LinkExists" LinkDirection="InBound" />

The sub-criteria

In this example we provided a criteria that will always be true.

<LinkCriteria LinkType="ProductItems" Operator="LinkExists" LinkDirection="InBound">
    <AlwaysTrueCriteria />
</LinkCriteria>

EntityExistsInChannelCriteria

Used to verify that en entity exists in a specific channel.

Properties

Name

Required

Property Type

Value type

ChannelId

Yes

Attribute

Int32

ChannelId

The channel id to verify that the entity exists in.

Examples

Example - Verify the entity exists in a channel with entity id 1

<EntityExistsInChannelCriteria ChannelId="1" />

CompoundCriteria

Used to group several criterias together, example: "This criteria is met when any/all sub-criterias is met"

Properties

Name

Required

Property Type

Value Type

Join

Yes

Attribute

Enum - Join

Join

  • And

    • All sub-criterias are met

  • Or

    • Any sub-criterias are met

Examples

Example - All sub-criterias are met This criteria will always be true no matter what, since the AlwaysTrueCriteria is always met, and the CompoundCriteria verifies that only one sub-criterias is met.

<CompoundCriteria Join="Or">
    <AlwaysTrueCriteria />
    <AlwaysFalseCriteria/>
</CompoundCriteria>

Example - Matching multiple entities in a hierarchy to a field on a single entity Here we create a compound criteria with the "Or" operator, and specify one criteria ment to match Product entities, and one ment to match Item entities, where Item is a child entity of Product.

In the first criteria, we will verify that a specific Product field matches a specific value.

In the second criteria, we will attempt to find the first Product parent from an Item, and then check that Product entity for the same criteria as above.

<CompoundCriteria Join="Or">
    <!-- Criteria for Product entities -->
    <FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" /> <!-- Verify that the field "ProductMarket" contains the value "SE" on the Product -->

    <!-- Criteria for Item entities, children of Product -->
    <LinkCriteria LinkType="ProductItems" LinkDirection="InBound" Operator="LinkExists"> <!-- Go from Item up to our Product parent -->
        <FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" /> <!-- Verify that the field "ProductMarket" contains the value "SE" on the Product -->
    </LinkCriteria>
</CompoundCriteria>

If there is another layer beneath the Item entity, for example "SKU", the example could look something like this

<CompoundCriteria Join="Or">
    <!-- Criteria for Product entities -->
    <FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" /> <!-- Verify that the field "ProductMarket" contains the value "SE" on the Product -->

    <!-- Criteria for Item entities, children of Product -->
    <LinkCriteria LinkType="ProductItems" LinkDirection="InBound" Operator="LinkExists"> <!-- Go from Item up to our Product parent -->
        <FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" /> <!-- Verify that the field "ProductMarket" contains the value "SE" on the Product -->
    </LinkCriteria>

    <!-- Criteria for Sku entities, children of Item -->
    <LinkCriteria LinkType="ItemSkus" LinkDirection="InBound" Operator="LinkExists"> <!-- Go from SKU up to our Item parent -->
        <LinkCriteria LinkType="ProductItems" LinkDirection="InBound" Operator="LinkExists"> <!-- Go from Item up to our Product parent -->
            <FieldCriteria FieldType="ProductMarket" Operator="Contains" Value="SE" /> <!-- Verify that the field "ProductMarket" contains the value "SE" on the Product -->
        </LinkCriteria>
    </LinkCriteria>
</CompoundCriteria>

AlwaysTrueCriteria

This criteria will always be met

Properties

No properties

Examples

<AlwaysTrueCriteria />

AlwaysFalseCriteria

This criteria will never be met

Properties

No properties

Examples

<AlwaysFalseCriteria />

Full example criteria configuration