David Nelson Posted February 11, 2014 Posted February 11, 2014 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
comment Posted February 11, 2014 Posted February 11, 2014 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). 1
David Nelson Posted February 12, 2014 Author Posted February 12, 2014 Thank you for explaining it for me. It just caught me off guard. I will use a different value list to split the needs up. "(and duplicates from the first fields will be allowed)." I can see I need to study value lists a lot more.
Recommended Posts
This topic is 3948 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 accountSign in
Already have an account? Sign in here.
Sign In Now