sam81 Posted May 13, 2014 Posted May 13, 2014 I am trying to concatenate unique child record for parent record...i was able to concatenate all child records for a given parent record using Substitute ( List ( child::record ) ; ¶ ; ", " )....but cannot figure out how do i remove the duplicate values for example: Car company has multiple models..but each model can only car, mid-suv, large-suv, truck etc.....now when i am populating information for Ford, i only want to have car, mid-suv and truck once not for all the model...and same for Hyundai can someone please guide about how to remove the extra child record during list thanks
eos Posted May 13, 2014 Posted May 13, 2014 Using your example: do you have a Types table? As in … Make (Manufacturer) --< Models >-- Types This lets you List () the types from the Types table, which will return a list with unique matching types.
Kris M Posted May 13, 2014 Posted May 13, 2014 I am trying to concatenate unique child record for parent record...i was able to concatenate all child records for a given parent record using Substitute ( List ( child::record ) ; ¶ ; ", " )....but cannot figure out how do i remove the duplicate values for example: Car company has multiple models..but each model can only car, mid-suv, large-suv, truck etc.....now when i am populating information for Ford, i only want to have car, mid-suv and truck once not for all the model...and same for Hyundai can someone please guide about how to remove the extra child record during list thanks http://www.briandunning.com/cf/1373 http://www.briandunning.com/cf/596 They are 2 of many custom functions that perform removwl of duplicate values from a list
comment Posted May 13, 2014 Posted May 13, 2014 http://www.briandunning.com/cf/1373 its a custom function called DeleteDuplicatesList ( listOfValues ) Do you think it's a good one? Note also that OP's profile shows 13 (not Advanced), so a recursive custom function is not the best recommendation for them.
David Jondreau Posted May 13, 2014 Posted May 13, 2014 If you have FM Advanced you could use a recursive custom function, like this:https://www.briandunning.com/cf/596 UniqueValues ( valueList ) Let([ //test val value = GetValue(valueList; 1); valCountFilter = ValueCount(FilterValues(valueList; value)); valCount = ValueCount(valueList); //new param newList = RightValues( valueList; valCount - 1); thisResult = Case(valCountFilter = 1 ; value & Case(valCount >1 ; "¶" )); //result result = thisResult & Case(valCount > 0 ; UniqueValues( newList ) ) ] ; result )
comment Posted May 13, 2014 Posted May 13, 2014 when i am populating information for Ford, i only want to have car, mid-suv and truck once If you do not have a table of Types, you can (if you haven't already) define a value list "Types" using values from the field "Models::Type". Then use a calculation = Substitute ( FilterValues ( ValueListItems ( Get (FileName) ; "Types" ) ; List ( Models::Type ) ) ; ¶ ; ", " ) This doesn't require the Advanced version to install - and it will be much faster than a recursive custom function to boot. --- You could also define the value list to show only related values, starting from Manufacturers, and eliminate the need for filtering - but you'd probably want to use the value list in order to populate the Type field in Models, so that would be less convenient. 1
sam81 Posted May 14, 2014 Author Posted May 14, 2014 @Kris/David: I cannot use UniqueValues as I have FMP advanced but not Advanced Pro...not sure how i add custom functions in FMP advanced....please let me know if there is other way around @consultant: i tried your logic...but for some reason it is not working....not sure why..do i need to create a filed 'Types' with valuelist from MOdels:type before i used the calculation...... Thank you for all your help !!
Kris M Posted May 14, 2014 Posted May 14, 2014 Do you think it's a good one? Note also that OP's profile shows 13 (not Advanced), so a recursive custom function is not the best recommendation for them. Comment : I did not notice the 13 not advanced caveat. My mistake. Next time I ref a CF in a post ill put in a disclaimer. OP: Comments solution is deffinately the best for your implementation.
Recommended Posts
This topic is 4182 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