cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
bimi82
Nintex Newbie

How do count the content within a field / array ?

Hello

 

I am using a repated section with a dropdown field [ItemStatus] "Booked" or "Collected".

I also added calculated [total_ItemStatus] value within the form to show the selected options e.g.:

 

[Collected, Booked, Collected]

 

Is there a way to count how many "Collected" are within the [total_ItemStatus] field?
I have tried something like, see below, but not working.

 

count(contains(ItemStatus, "Collected"))

Any advise?

Labels: (1)
Tags (1)
0 Kudos
Reply
3 Replies
Automation Master
Automation Master

Re: How do count the content within a field / array ?

if ItemStatus field is a choice and/or there is reasonable amount of statuses you could approach it with auxiliary caluclated values - one for each status - that would evaluate to 0/1 based on whether actual status is one the calculation is for or not. finally sum up auxiliary calculations into totals

see similar examples

https://community.nintex.com/t5/Nintex-for-SharePoint/How-to-conditionally-sum-up-the-values-from-a-...

https://community.nintex.com/t5/Nintex-for-SharePoint/Display-value-based-on-day-of-week/m-p/30779/h...

 

 

 

if ItemStatus is lookup or there are too many statuses, resp. you want to calculate it automatically based on statuses selected, you'd need quite complex javascript solution.

eg. one like @MegaJerk described here

https://community.nintex.com/t5/Nintex-for-SharePoint/Sum-a-a-section-amount-based-on-the-lookup-con...

0 Kudos
Reply
bimi82
Nintex Newbie

Re: How do count the content within a field / array ?

Hi

Just to demonstrate my request:

Count_RepeatedSection.jpg

 

I have taken your suggestion into account and added another Calculated Value within the RepeatedSection naming it [CountItemStatus] as following:

 

if(ItemStatus=="Collected", 1, 0) 

So then I can use sum() to show the total of the amount Smiley Happy great idea.

sum(CountItemStatus)


My inidial idea was to use the already existing Cal.Value [total_ItemStatus] which then shows the result in a row [Value, Value, Value] (see picture).

 

I thought, maybe, there is away counting from that field how many "Collected" or "Booked" are?

 

By adding more and more Cal.values, it will then generate more entries within the HTML /XML output as it stores into a multiline text field, which I am planning to use later to show user:

 

- how many items you have pending for collection (booked)

- how many items have been collected and by whom.

 

Smiley Happy

 

Hint: the Items 1 of 1, 2 of 1 etc is yet another calc.value which sums up the [currentRowNumber] and the [Items] which is manually selected by the user as a drop down, to specify the amount of items. In this sample, I left 1 by default hence why it shows 1 of 1 and 2 of 1 . lol

0 Kudos
Reply
Automation Master
Automation Master

Re: How do count the content within a field / array ?

I thought, maybe, there is away counting from that field how many "Collected" or "Booked" are?

unfortunatelly, nintex doesn't provide such a functionality.

 

 

 

By adding more and more Cal.values, it will then generate more entries within the HTML /XML output as it stores into a multiline text field, which I am planning to use later to show user:

I'd say that shouldn't matter.

you will anyway need to (pre)process repeater XML into something more undestandable by end users. so you can pick just columns that make sense for them.

0 Kudos
Reply