Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!

Passing the count result value?

Avatar

Level 4

Hi everyone,

 

I'm a bit puzzled with this issue, so I would appreciate any advice how to fix it. 

 

In one of the flows, I filter out specific results and count them with iterator (increment function), then store in the variable. For example, I have 5 bundles meeting the filter criteria and thus I have 5 bundles in stored variable.

Then I need to use this result value in another flow, so I use Get variable module to access it, but for some reason I get number 4 here, instead of 5. I'm not sure what I'm missing here. 

How can I get the right result (i.e. 5 in this case)? Any ideas?

 

Could you please advise?

6 Replies

Avatar

Level 6

It sounds like you have a reference problem that is specific to the scenario.  If you can post more details, it might be possible to debug.

But I suspect you're not updating the reference inside the iterator.  Note that Fusion uses pass by value and not pass by reference.  Check this out:

Screen Shot 2024-02-14 at 11.04.04 PM.png

I've also attached this scenario to the thread.  You can import it as a test if you want to see how it works.

Avatar

Level 4

Thank you for your suggestion, I really did not explain well what I'm trying to achieve.

 

Simply speaking, I need to fetch the count result (or just number of bundles). I need to know how many bundles meet this filter criteria and then I could use it, for example, in a note: "5 bundles went route A, 3 bundles went route B", It would be even better to have total number of bundles too.

 

This is just one part of a bigger scenario. In this part (before count), we search data in datastore, then we create csv for one flow and then in another (in this branch) we parse CSV, set variables and process this info for sending out notifications and adding data to the report.

As you may see in the example below, we have 5 bundles coming out of Set variables module and then they meet the filter criteria and go to the "Success" branch, where I try to get this count number (just a number of bundles coming here).

Is there a way to fetch it?

 

Viktoriia_0-1708044549378.png

 

 

Avatar

Level 6

Screen Shot 2024-02-15 at 8.09.15 PM.png

 

I would set counters, one per branch, and then -- inside the branch -- get the counter ref for the specific branch and increment it.  Once you're outside all the branches, then you can get all the counter refs again for the resulting numbers.

Avatar

Level 4

I tried to do so, but I can't combine values in one array and get the total number.

Could you please share your scenario?

Avatar

Level 6

Sure, the blueprint is attached.

If you're just looking to get the length of an array, there's a function for that:

Screen Shot 2024-02-16 at 4.17.06 AM.png

You can also sum individual counters if you want to know how many executions went down which path.

I'm trying to figure out if the source of your confusion is around how CSVs split an aggregate into parts (bundles) in terms of control flow and scope, and if you're trying to re-aggregate out of that.  If so, you may want to look at https://experienceleague.adobe.com/docs/workfront/using/adobe-workfront-fusion/modules-in-fusion/agg....  There are several different types of aggregators available, not just the one that is shown on that page.

Avatar

Level 4

Thank you very much for your help and sharing your solution.

 

Yes, the issue appeared to be in Parse CSV that was modified before to process specific values containing commas. 

 

I ended up replacing it with regular one and also added rowNumber field (we had one in datastore, but there was no need to use it before). Then I was able to use the following set up to get what I needed:

1 - Router with filters to preselect different values matching the condition

2 - Numeric aggregator in each route - with Count function, grouping and using rowNumber as Value

3 - Storing results of each Counter in the variable to use in further flow

 

Viktoriia_1-1708467753204.png