1

I'm working with AWS Step Functions to save records to DynamoDB. I am trying to control the name of the DynamoDB record based on the input

Based on an input of number1, the record should be 'lesser' or 'greater' for example.

const saveInDynamoDbState = new DynamoPutItem(this, 'saveInDynamoDbState', {
      table: props.table,
      item: {
        id: DynamoAttributeValue.fromString(
          JsonPath.stringAt(
            "States.Format('{}', (JsonPath.numberAt('$.number1') > 0 ? 'greater' : 'lesser'))",
          ),
        ),
       ....
     }
    });

but it seems like the logic is being ignored. I asked Amazon Q and it recommended States.MathMin/States.MathMax which I don't even think exists based on these docs (https://docs.aws.amazon.com/step-functions/latest/dg/intrinsic-functions.html#asl-intrsc-func-math-operation )

3
  • Could you add more information to help us to understand the question? Commented Nov 26, 2024 at 23:18
  • I'm trying to dynamically name the record using logic based on the input. I don't know if the name is pre-computed but this result seems to be ignored (JsonPath.numberAt('$.number1') > 0 ? 'greater' : 'lesser'). I want to know why, and how I need to write it. Commented Dec 2, 2024 at 14:24
  • You will probably need a Choice to decide which one to write. Commented Jun 2 at 23:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.