# Condition

A Condition for use in a Choice state branch.

- Source: [`aws-stepfunctions/lib/condition.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-stepfunctions/lib/condition.ts#L8)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

```ts
const map = new sfn.Map(this, 'Map State', {
  maxConcurrency: 1,
  itemsPath: sfn.JsonPath.stringAt('$.inputForMap'),
  itemSelector: {
    item: sfn.JsonPath.stringAt('$$.Map.Item.Value'),
  },
  resultPath: '$.mapOutput',
});

// The Map iterator can contain a IChainable, which can be an individual or multiple steps chained together.
// Below example is with a Choice and Pass step
const choice = new sfn.Choice(this, 'Choice');
const condition1 = sfn.Condition.stringEquals('$.item.status', 'SUCCESS');
const step1 = new sfn.Pass(this, 'Step1');
const step2 = new sfn.Pass(this, 'Step2');
const finish = new sfn.Pass(this, 'Finish');

const definition = choice
    .when(condition1, step1)
    .otherwise(step2)
    .afterwards()
    .next(finish);

map.itemProcessor(definition);
```

## Initializer

```ts
new Condition()
```

## Methods

- `and(...conditions: Condition[]): Condition // chainable` (static) — Combine two or more conditions with a logical AND.

- `booleanEquals(variable: string, value: boolean): Condition // chainable` (static) — Matches if a boolean field has the given value.

- `booleanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a boolean field equals to a value at a given mapping path.

- `isBoolean(variable: string): Condition // chainable` (static) — Matches if variable is boolean.

- `isNotBoolean(variable: string): Condition // chainable` (static) — Matches if variable is not boolean.

- `isNotNull(variable: string): Condition // chainable` (static) — Matches if variable is not null.

- `isNotNumeric(variable: string): Condition // chainable` (static) — Matches if variable is not numeric.

- `isNotPresent(variable: string): Condition // chainable` (static) — Matches if variable is not present.

- `isNotString(variable: string): Condition // chainable` (static) — Matches if variable is not a string.

- `isNotTimestamp(variable: string): Condition // chainable` (static) — Matches if variable is not a timestamp.

- `isNull(variable: string): Condition // chainable` (static) — Matches if variable is Null.

- `isNumeric(variable: string): Condition // chainable` (static) — Matches if variable is numeric.

- `isPresent(variable: string): Condition // chainable` (static) — Matches if variable is present.

- `isString(variable: string): Condition // chainable` (static) — Matches if variable is a string.

- `isTimestamp(variable: string): Condition // chainable` (static) — Matches if variable is a timestamp.

- `jsonata(condition: string): Condition // chainable` (static) — JSONata expression condition.

- `not(condition: Condition): Condition // chainable` (static) — Negate a condition.

- `numberEquals(variable: string, value: number): Condition // chainable` (static) — Matches if a numeric field has the given value.

- `numberEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a numeric field has the value in a given mapping path.

- `numberGreaterThan(variable: string, value: number): Condition // chainable` (static) — Matches if a numeric field is greater than the given value.

- `numberGreaterThanEquals(variable: string, value: number): Condition // chainable` (static) — Matches if a numeric field is greater than or equal to the given value.

- `numberGreaterThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a numeric field is greater than or equal to the value at a given mapping path.

- `numberGreaterThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a numeric field is greater than the value at a given mapping path.

- `numberLessThan(variable: string, value: number): Condition // chainable` (static) — Matches if a numeric field is less than the given value.

- `numberLessThanEquals(variable: string, value: number): Condition // chainable` (static) — Matches if a numeric field is less than or equal to the given value.

- `numberLessThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a numeric field is less than or equal to the numeric value at given mapping path.

- `numberLessThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a numeric field is less than the value at the given mapping path.

- `or(...conditions: Condition[]): Condition // chainable` (static) — Combine two or more conditions with a logical OR.

- `renderCondition(): any` — Render Amazon States Language JSON for the condition.

- `stringEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a string field has the given value.

- `stringEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a string field equals to a value at a given mapping path.

- `stringGreaterThan(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts after a given value.

- `stringGreaterThanEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts after or equal to a given value.

- `stringGreaterThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts after or equal to value at a given mapping path.

- `stringGreaterThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts after a value at a given mapping path.

- `stringLessThan(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts before a given value.

- `stringLessThanEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts equal to or before a given value.

- `stringLessThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts equal to or before a given mapping.

- `stringLessThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a string field sorts before a given value at a particular mapping.

- `stringMatches(variable: string, value: string): Condition // chainable` (static) — Matches if a field matches a string pattern that can contain a wild card (*) e.g: log-*.txt or *LATEST*. No other characters other than "*" have any special meaning - * can be escaped: \\*.

- `timestampEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is the same time as the given timestamp.

- `timestampEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is the same time as the timestamp at a given mapping path.

- `timestampGreaterThan(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is after the given timestamp.

- `timestampGreaterThanEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is after or equal to the given timestamp.

- `timestampGreaterThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is after or equal to the timestamp at a given mapping path.

- `timestampGreaterThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is after the timestamp at a given mapping path.

- `timestampLessThan(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is before the given timestamp.

- `timestampLessThanEquals(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is before or equal to the given timestamp.

- `timestampLessThanEqualsJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is before or equal to the timestamp at a given mapping path.

- `timestampLessThanJsonPath(variable: string, value: string): Condition // chainable` (static) — Matches if a timestamp field is before the timestamp at a given mapping path.
