Greg Hains Posted April 6, 2019 Posted April 6, 2019 Good afternoon, (I'm not sure this is the right section, but seemed the most appropriate that I can find.) I have three fields ("type", "client", and "expense"). Each field has 10 repetitions. I have a button that will clear out the n'th repetition of all three fields - so the whole line is blanked should the user need to do so. What I would like to do is then remove that empty line, moving all the data from all subsequent fields "up" one. (n-1), thus keeping the list compact and free of blank lines. I did write a loop that did this, but it was very clumsy, and thought that somebody may know of a cleaner way using existing functions and smarter (than my-) logic to achieve this please? Many thanks in advance if anybody has any ideas. Greg
comment Posted April 6, 2019 Posted April 6, 2019 I would suggest you solve this by changing your structure: instead of repeating fields, use records in a related table. Then you can simply delete a record and the gap in the portal showing the related records will close automatically, without you having to do anything. Not to mention numerous other advantages offered by having a proper relational structure.
Greg Hains Posted April 6, 2019 Author Posted April 6, 2019 Hi Comment, Thank you, and yes, you are right - a portal would be a better approach. The problem here was becoming more theoretical and experimental to me now than anything. Cheers, Greg
comment Posted April 6, 2019 Posted April 6, 2019 Well, in theory, assuming that any repetition of the three fields would be either empty or non-empty in all three of them, you could gather the remaining values into 3 variables using the List() function (which skips empty values). Then loop populating all repetitions with the corresponding value from the corresponding variable. But really, this is not the best way, and hasn't been ever since Filemaker went relational in version 3 (1995).
Greg Hains Posted April 6, 2019 Author Posted April 6, 2019 Hi Comment, Thank you. Loud and clear. lol I am using the portal method and it works fine, but I was revisiting another part of a solution (I inherited) that had the repeating fields and was probably just wasting time trying to find a solution to it. Let's close this one. I shouldn't be wasting time anyway. Thanks again. Greg
Recommended Posts
This topic is 2056 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