June 20, 200718 yr I'm sure this is an easy one... I just can't wrap my head around it: I have a portal to track the value history of a piece of artwork. Artwork being the Base Table, linked via record id to the table containing all the values entered over time. Simple. How can I get the most recent value (date = key-field) to flow into a field in the Base Table? The idea is to be able to display the value or the artwork in the list view of the Base Table. Can anyone help? Thank you so much! Michael
June 20, 200718 yr Well beyond using a real values as key, should be restrained to filtered portals, does following come to mind: http://www.filemaker.com/help/Functions%20Ref5.html http://www.filemaker.com/help/FunctionsRef-339.html There are more ways to skin it, but let's leave it here for now! --sd
June 20, 200718 yr Author Thank you for your quick reply, Søren! The problem with Max(values::field) is that it returns the largest value (which is not necessarily the latest one: the artwork could loose value over time) The problem with Last(values::field) is that the user might want to complete the value history of an artwork: if he enters an appraisal he had missed from a year ago, according to FM that one is the "last one", which is not useful. That's why I thought I had to link it to the date field in values somehow, but couldn't figure out how to make that work. Edited June 20, 200718 yr by Guest
June 20, 200718 yr Another option is to List( all the recordKeys in the related table and LeftValues(myList;ValueCount(myList)-1) ...and relate it via a non equal relation. I would in your case, start swearing or other noises - over the blunder it is to have forgotten a recordID in every single of the tables. If you relation is set up sorted double the TO and make a new one sans the sortorder and aggregate the List( over it. But suddenly does both Last( and Max( begin to make more sense again, but all of them are overkill. Since an unstored calc, over a reversely sorted relation pulling the first related value will always get the ID of the latest, if it's needed at all. If you just need to show an image use an extra TO reverse the creation order in the relations def and show the image without a portal. --sd
June 20, 200718 yr If you sort the related records by date ascending (in the relationship's definition), Last() will get you data from the latest related record. If you sort by date descending, you can place the related field/s directly on the parent layout - it will always show data from the first related record, which is the latest record. EDIT: Alternatively, if you don't want to sort the relationship (and don't want to create a duplicate relationship just for this), you can place a one-row portal on the parent layout, and sort the portal by date descending. Edited June 20, 200718 yr by Guest
June 20, 200718 yr Author Awesome, "comment"! Your answer so simple and powerful. Exactly what I needed... Edited June 20, 200718 yr by Guest
June 20, 200718 yr Your answer so simple and powerful. Exactly what I needed... Yes, I can only envy the conciseness, he manages to get away with. I said the same, or rather intended to do so However do I hope I can beat him with his danish skills. --sd
June 20, 200718 yr I hope I can beat him with his danish skills. It depends: are we talking about speaking it or eating it?
June 20, 200718 yr If you eat is it not danish but "Wienerbrød" but the lard it's made of is neither kosher nor the dietists first recommendation. You're likely to get pimples on your backside, if you doesn't restrain yourself. --sd
June 20, 200718 yr Author Haha, you guys are funny! I appreciate the help of both of you. I have to admit though, I just had a hard time figuring out WHAT you were telling me to do Søren - language barrier...
June 20, 200718 yr Nice try, but trash-talking won't help you - bring it on! It's funny, BTW, that the Danish call it Viennese bread(?)
Create an account or sign in to comment