Jump to content
Server Maintenance This Week. ×

ValueCount miscounts value list?


David Nelson

This topic is 3740 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Well probably not but it did not do what I expected so I would like to mention it.

 

I have a script which counts the values in a value list and acts accordingly. It is based on 'all values in field'. It recently broke saying there were less values than there were and all I had done was change the sort order of the value list.

 

Please see attached. First button was my original. We did not use this value list for data-entry, only to get the count of all products for my script. Alternate code is not required.  But then another situation wanted only the alternate codes to display for selection in another layout and I thought, perfect, I already have just the thing.

 

I knew the value list was based upon all values. And I knew it included both fields even if I change the sort to sorting on the second field instead of the first.  Therefore the count of the list should remain the same - all values of the stock code.

 

WRONG. 

 

So even though I list 'all values' and 'include both fields', it does not count a value if the second field is empty.  

 

I can understand the third button.  If it is based only on second field and it is empty then it would not count it.  But we are talking about sorting not indexing, aren't we?  All values and both fields should produce the full count shouldn't it?

 

This is mostly a caution to others and hopefully some indication why button 2 does not count the StockCodes.  Thank you for listening.

CountValues.fp7.zip

Link to comment
Share on other sites

So even though I list 'all values' and 'include both fields', it does not count a value if the second field is empty. 

 

That's not an entirely correct way to put it. First, it's not about counting the values. If you remove the ValueCount() wrapper from your calc and look directly at ValueListItems() you will see that the value is not there to be counted.  The reason it's not there is that when you sort a value list by the second field, you are also supposed to select a value by the second field - and you cannot select an empty value.

 

This is similar to discarding duplicate values from the list; if the list is sorted by the second field, only unique values from the second field will be shown (and duplicates from the first fields will be allowed).

  • Like 1
Link to comment
Share on other sites

This topic is 3740 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.