agaperrk Posted September 20, 2008 Posted September 20, 2008 I have a portal that creates a list of activites, I want to grab that last portal row and get it to display in another field. Example I worked on something I gave it a date and description and Location This is a table that displays on another table in a portal. I have it sorted so the first record by date is the one I want. I want it to show on my next table in two fields one field is the date the other is description. I use this field in other layouts so I do not want the portal in every layout. That is it. Thanks in advance. I know this is easy I just seemed to be off a little.
Fitch Posted September 21, 2008 Posted September 21, 2008 If you sort your existing relationship or create another relationship and sort it, you can use the related fields without a portal: the data displayed will be from the first related record, determined by the sort order.
agaperrk Posted September 21, 2008 Author Posted September 21, 2008 If you sort your existing relationship or create another relationship and sort it, you can use the related fields without a portal: the data displayed will be from the first related record, determined by the sort order. I understand that, I am trying to grab the latest row from the portal and place in a different table without a sort. Just one field with a calc to pick up the latest portal record. It is an activity of events and I am getting the last one putting it on a different table and when I add a new event the info would change automatically and then I would pull different info based on that.
Vaughan Posted September 21, 2008 Posted September 21, 2008 "I have a portal that creates a list of activites, I want to grab that last portal row and get it to display in another field." Have you tried the Last() function?
agaperrk Posted September 22, 2008 Author Posted September 22, 2008 "I have a portal that creates a list of activites, I want to grab that last portal row and get it to display in another field." Have you tried the Last() function? no i have not tried that, you think that I can use the first() function? () or last () Function () I am not sure how to code that to just get the first or last row from the portal.
mr_vodka Posted September 22, 2008 Posted September 22, 2008 If you create a calc that uses Last ( YourPortalRelationship::YourField ) it will return the value for your field of the last record based on the same relationship that your portal uses.
agaperrk Posted September 22, 2008 Author Posted September 22, 2008 If you create a calc that uses Last ( YourPortalRelationship::YourField ) it will return the value for your field of the last record based on the same relationship that your portal uses. The first portal is the one I want, What will to do for that. I have the portal sorting ascending.
mr_vodka Posted September 22, 2008 Posted September 22, 2008 (edited) The first portal is the one I want, What will to do for that. I have the portal sorting ascending. I am assuming you are talking about the first ROW here... If you want the first record from the portal, all you have to do is put the field on the layout using the same relationship of the portal. It will return the first related record's data. Would you be able to explain your situation a little more clearly here? In your first post you mention you wanted the last portal row and now it seems you want the first. Why dont you use your real table names and fields instead of abstract ones. It may be easier for us to follow. Edited September 22, 2008 by Guest
comment Posted September 22, 2008 Posted September 22, 2008 Note that in a calculation, first and last follow the sort order of the relationship, not the sort order of any portal. To get data from the first related record, reference the desired field name/s directly. If this is for display only, and your relationship is not sorted the way you need for this, you could simply put the related fields in a one-row portal and sort the portal.
agaperrk Posted September 22, 2008 Author Posted September 22, 2008 Note that in a calculation, first and last follow the sort order of the relationship, not the sort order of any portal. To get data from the first related record, reference the desired field name/s directly. If this is for display only, and your relationship is not sorted the way you need for this, you could simply put the related fields in a one-row portal and sort the portal. ok I put that calculation in the field I wanted the data. It works on some of them and on some of them it pulls from the portal but not the last record in the list. Not sure why.
comment Posted September 22, 2008 Posted September 22, 2008 It's not possible to help you without you providing better information to help us know what's going on. You say you "put that calculation in the field" - but I have no idea which calculation you mean. My guess is that what you have now is not working at all, and the "correct" results you see are purely coincidental. You say "it pulls from the portal" - but I have just explained that portals are irrelevant to the calculation. There's no way for a calculation to know about portals - portals are on layout (presentation) level, calculations work on the data level. You could have any number of portals on the layout (or several layouts), each one based on the same relationship, and each one sorted by its own sort order. The only sort order that a calculation respects is the sort order defined in the relationship's definition.
agaperrk Posted September 23, 2008 Author Posted September 23, 2008 ok I put that calculation in the field I wanted the data. It works on some of them and on some of them it pulls from the portal but not the last record in the list. Not sure why. This only works part time. It does not pick the latest or the last record in the portal because the last record may have been changed,, date etc. So if I am looking for the last date it will not grab it. is there another funtion I can use.
comment Posted September 23, 2008 Posted September 23, 2008 I still have no idea what "this" is, and I am getting tired of asking you to provide a clearer explanation. I have the feeling you haven't read my last two posts at all.
agaperrk Posted September 23, 2008 Author Posted September 23, 2008 I still have no idea what "this" is, and I am getting tired of asking you to provide a clearer explanation. I have the feeling you haven't read my last two posts at all. ok I will try again. I have a data base that has people in it. I have a portal that relates to another table. The other table just keep the events that person has worked on. In the portal I sort the data from newest to oldest. I want to pull that last line an put it in two field on my main data base. Basically a description and date. In the field on the main data base I did a calculation to collect the last record. This however only works on a few records, I do not know the reason. So I need a calculation to equal the last record in the portal.. Which is sorted by data. Man I hope I have explained it good enough. Thanks.
comment Posted September 24, 2008 Posted September 24, 2008 Have you sorted the related records from Events, in the definition of the relationship (not the portal), by date?
Vaughan Posted September 24, 2008 Posted September 24, 2008 If the Last() functions isn't working for you then probably have problems with the data structure. It should work. What is the relationship between the two tables: how is it set up?
agaperrk Posted September 24, 2008 Author Posted September 24, 2008 If the Last() functions isn't working for you then probably have problems with the data structure. It should work. What is the relationship between the two tables: how is it set up? The only thing I can think of is that I put the events in and later went back and put the dates of the events later and the sort is working but the last function my be picking the last record I created in the portal verses the last one sorted.
Fenton Posted September 24, 2008 Posted September 24, 2008 (edited) The Last() function does not see the sort of the portal. That is only a specific layout object sort. Last() sees the last non-empty value of the relationship::field specified; so sort the relationship. [ I see comment already said this a while back. But there is something going here. Is the Last() function using the sorted relationship? ] Edited September 24, 2008 by Guest
Fitch Posted September 24, 2008 Posted September 24, 2008 Randy, forget about the sort order that you applied to the portal. Go into your relationship graph and specify the sort order there.
Vaughan Posted September 24, 2008 Posted September 24, 2008 My concern is that the relationship itself might not be setup correctly. It might be time to post the file.
comment Posted September 24, 2008 Posted September 24, 2008 Actually, now is not a good time to post anything: http://fmforums.com/forum/showtopic.php?tid/191871/
Recommended Posts
This topic is 5904 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