Skip to content

isLast in nested forEach #404

Description

@hafnerpw

Hi, I can't make {{#unless isLast}} work inside a nested foreach. Here is what I'm trying:

{ "release": "{{releaseDetails.releaseDefinition.name}}", "release_number": "{{releaseDetails.name}}", "date": "{{releaseDetails.modifiedOn}}", "workItems": [ {{#forEach this.workItems}} { "id": "{{this.id}}", "title": "{{lookup this.fields 'System.Title'}}", "type": "{{lookup this.fields 'System.WorkItemType'}}", "tags": "{{lookup this.fields 'System.Tags'}}", "pullRequests": [ {{#forEach this.relations}} {{#if (contains this.attributes.name 'Pull Request')}} {{#with (lookup_a_pullrequest ../../pullRequests this.url)}} { "id": "{{this.pullRequestId}}", "title": "{{this.title}}", "description": {{{json (lookup this 'description')}}}, "closedDate": "{{this.closedDate}}", "labels" : {{{json this.labels}}} }{{#unless ../../isLast}}, {{/unless}} {{/with}} {{/if}} {{/forEach}} ] }{{#unless isLast}}, {{/unless}} {{/forEach}} ] }

Ii believe it is only checking the outter forEach because the last WorkItem also does not have a comma. Am I doing something wrong ?

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