James Gill Posted April 1, 2010 Posted April 1, 2010 (edited) I've created a database that has a line item entry containing a field for Type. This field is populated using a value list that I've created. My ultimate goal is have to a calculated field that will contain only 1 occurrence of each type of item on my line item list, but the List function is resulting in strange behavior. I have a total of 10 line items encompassing 5 different types. Using the list function my calculated field displays some values as repeated and other values only once, leaving a total of 7 values. Obviously this is less than my total number of line items, but there are also repeated values in my list. Any idea what's going on? Edited April 2, 2010 by Guest
jamesducker Posted April 1, 2010 Posted April 1, 2010 When you define a value list based it on the contents of a field, for all practical purposes it will always deduplicate the list for you and sort it in to alphabetical order. List(table::field) doesn't do that deduplication or sorting. It's behaving perfectly normally. What are you aiming to achieve? James
James Gill Posted April 2, 2010 Author Posted April 2, 2010 My goal is have to a calculated field that will contain only 1 occurrence of each type of item on my line item list So; Type 1 Type 1 Type 1 Type 2 Type 2 Type 3 into a list that looks like; Type 1 Type 2 Type 3
Vaughan Posted April 2, 2010 Posted April 2, 2010 Use the UniqueValues custom function on Brian Dunning's web site. You'll need FMP Advanced to install the cf.
RodSierra Posted April 2, 2010 Posted April 2, 2010 Why not use the design function: ValueListItems ( Get ( FileName ) ; "YourValueList" ) ?
LaRetta Posted April 2, 2010 Posted April 2, 2010 ValueListItems ( Get ( FileName ) ; "YourValueList" ) Since you already have a value list of Type, James Gill, then it makes sense to use it here (as both jamesducker and RodSierra pointed out). But be sure to make the calculation unstored (in Options, Storage). If you didn't already have a value list (or you don't want vl behavior of sorting) then using a custom function as Vaughan pointed out would be the way to go.
James Gill Posted April 2, 2010 Author Posted April 2, 2010 I'll try this but I don't think that this function is going to work for what I'm trying to accomplish. It looks as if this function is going to list every item of a value list across a specific file. I want this function to list the contents of a value list in content to what has been selected as part of a line item order. fake edit: I just tried the function and it does list all values across the database and not only those that are part of my line item order.
James Gill Posted April 2, 2010 Author Posted April 2, 2010 Brian Dunnings Custom functions seems to work better, although for some reason it's only returning one value at a time. Thoughts?
comment Posted April 2, 2010 Posted April 2, 2010 It looks as if this function is going to list every item of a value list across a specific file. I don't think you understand the suggestion made here (or that it has been made clearly enough) In order to list only unique values from the child items, you need to define a SECOND value list - using values from field LineItems::Type, show only related values starting from Orders. Then use the ValueListItems() function with this value list. Another option (IMHO, preferable) is to use the EXISTING value list in this manner = FilterValues ( ValueListItems ( Get (FileName) ; "Values" ) ; List ( LineItems::Type ) ) Since value list items are indexed, both of these will be much faster than a custom sorting function.
bruceR Posted April 3, 2010 Posted April 3, 2010 I'll try this but I don't think that this function is going to work for what I'm trying to accomplish. It looks as if this function is going to list every item of a value list across a specific file. I want this function to list the contents of a value list in content to what has been selected as part of a line item order. What does that mean? Perhaps you mean, as Comment suggests, that you want only values from a particular order. That's easy enough and he tells you how. But that isn't quite what you're saying. You're adding qualifiers: "what has been selected" and "as PART of a line item order." So how is anything supposed to figure out which part?
Recommended Posts
This topic is 5407 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