Skip to content

Is there any possible way to calculate this using gorules? #397

@daway0

Description

@daway0

Imagine my input request is structured like this:

{
  "totalAmount": 0,
  "items": [
    {"name": "hotdog", "price": 10}, 
    {"name": "burger", "price": 20}
  ]
}

The desired output must be:

{
  "totalAmount": 30, 
  "items": [
    {"name": "hotdog", "price": 10}, 
    {"name": "burger", "price": 20}
  ]
}

I'm attempting to achieve this using an expression node in loop mode, but I cannot access and modify the totalAmount field while iterating through the loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions