madman411 Posted May 20, 2021 Posted May 20, 2021 (edited) Hi all I'm trying to display a list inside one field on one row that contains the field values of the related child records. Using UniqueValues() I'm able to filter that list down to remove duplicates, of which there are many for some records. The following calculation works as expected, however UniqueValues() seems to be counting an extra blank record at the end and I'm struggling to find how this is happening. I'm using Substitute() to replace carriage returns with a comma to keep the data on one line. If left as a list there is a blank row at the bottom of the field. When subbing returns for commas the last returned item is followed by a comma. See below: Substitute ( UniqueValues ( List ( Product Assets::ownership ) ) ; "¶" ; ", " ) Record One Record Two Record Three Record One, Record Two, Record Three, Perhaps there's another way to achieve this, and/or I'm missing something simple. Suggestions appreciated! Edit: Ok, after further reading I realize this is normal behavior. Edited May 20, 2021 by madman411
comment Posted May 20, 2021 Posted May 20, 2021 All xValues functions include a trailing carriage return in their result. In your example, you could do: Substitute ( UniqueValues ( List ( ChildTable::Valuefield ) ) & ¶ ; [ "¶¶" ; "" ] ; [ ¶ ; ", " ] ) 2
madman411 Posted May 20, 2021 Author Posted May 20, 2021 5 minutes ago, comment said: All xValues functions include a trailing carriage return in their result. In your example, you could do: Substitute ( UniqueValues ( List ( ChildTable::Valuefield ) ) & ¶ ; [ "¶¶" ; "" ] ; [ ¶ ; ", " ] ) Thanks comment - of course this worked. You're a star. Can you explain what is happening in this function so I can better understand? Cheers
comment Posted May 20, 2021 Posted May 20, 2021 First we append another CR to the result of UniqueValues(), so we get: "Record One¶Record Two¶Record Three¶¶" Now we substitute (1) a pair of CRs with nothing: "Record One¶Record Two¶Record Three" and (2) a CR with comma and space: "Record One, Record Two, Record Three" 1
Recommended Posts
This topic is 1353 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