[Resolved] Order of foreach Results

Uploaded report templates and discussions about reports.

Moderators: sarawut_w, Moderators

[Resolved] Order of foreach Results

Postby JYeggy » Wed Sep 04, 2019 11:31 am

Hi,

I am fairly new to the report generation tool, and currently I am trying to create a list of stakeholder concerns, however I am unsure how the array that is searched is output. It does not appear to follow any particular order, and that the results output in a random manner. Is there a way to organized the "StakeholderConcern" array before it is searched to output in a particular order when called with foreach? I would have assumed it would follow the Id numbers or the way they were created, but again I see no pattern in the output.

For example, I will call using this:
Code: Select all
#foreach ($s in $StakeholderConcern)
$s.id
#end


and the output looks like:
SC10
SC13
SC2
SC11
SC5
SC12
SC8
SC3
SC7
SC4
SC6
SC1
SC9


Despite these being each objects id number, it lists out of order. Is there a way to easily organize this? I couldn't find anything in the documentation that describes how Cameo creates these arrays that foreach uses.

Best Regards.

Edit: After further exploration, the following worked.
Code: Select all
#foreach ($s in $sorter.humanSort($StakeholderConcern, ‘id:asc’))
$s.id
#end
JYeggy
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Wed Sep 04, 2019 11:08 am

Return to Report Engine

Who is online

Users browsing this forum: No registered users and 0 guests