Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isLast in nested forEach #404

Open
hafnerpw opened this issue Jan 16, 2022 · 0 comments
Open

isLast in nested forEach #404

hafnerpw opened this issue Jan 16, 2022 · 0 comments

Comments

@hafnerpw
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant