Skip to content

Referencing items from other resources in loops (copy index) #2034

Answered by majastrz
fluffy-cakes asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the local loop's index i in the myRoutes[i].name expression. If i exceeds the range of the myRoutes array, you will get a failure at deployment time, though.

I feel like something is missing from the expression at:

routeTable: {
  id: myRoutes[].name == 'asdf'
}

id properties are usually strings and that expression above returns a bool type. Are you trying to conditionally set different IDs? Or something else?

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@fluffy-cakes
Comment options

@majastrz
Comment options

@fluffy-cakes
Comment options

@majastrz
Comment options

@brwilkinson
Comment options

Answer selected by brwilkinson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants