Jump to content

Recommended Posts

Posted

I have a filtered portal on layout, where I want to identify which portal row each row is and be able to identify this on the layout

Table name is 'Contacts'

On my layout, I have used a new relationship so the table used is 'Contacts_2'

I have created a calculation in the Contacts table that runs in the context of the Contacts_2 table of 'Get (RecordNumber)'. This field shows correctly on with the portal row number.

However on the main layout, when I have selected a contact in the portal, I populate the rest of the fields in main layout from table 'Contacts' based on a relationship, and I want to show the portal row number from the corresponding record in 'Contacts_2", it it only ever displays '1'

Any help please, if this possible?

Thanks

 

Posted

I am struggling to understand your question - and even more to understand the purpose behind it.

An unstored calculation of Get (RecordNumber) returns different results in different contexts: the same record may be the 7th in the current found set, but it could be the 5th in a portal, and the 3rd in a filtered portal based on the same relationship.

Likewise the same record could be at different positions in two identical found sets (or portals) if the two are sorted in different orders.


So the question is what exactly are you trying to accomplish here? I have a hunch that Get (RecordNumber) may not be the right tool to achieve it.

 

Posted (edited)

Apologise if I wasn't clear. Maybe I don't have the correct calculation.

Layout is Generic table layout that has a relationship to Contacts_2, which displays a filtered portal on the left. Generic::GlobalContact_group_id = Contacts_2::group_ID.

So this will show all the contacts in the portal on the left that match the current Contact group ID. Portal is filtered based on certain information, so not all items in the Contacts_2 table will appear and may be gaps based on the actual contacts table.

Depending on which Portal record is selected on the left, the main page data its populated from a relationship on the main layout using a global field - Generic::GlobalContactID = Contacts::PrimaryKey.

I also want to use 'Next' and 'back' buttons on the main layout to move to the next record that is displayed on the portal on the left, and use the "go to portal row' to move the portal to the current record being shown. 

But I'm trying to capture what the portal row number is on the left within the main layout to use in my calculation on where to send' Got to portal row' by calculation

 

 

Edited by Chrism
Posted (edited)

I am afraid I still don't understand the purpose of this exercise.

Suppose the filtered portal is showing records for (1) Adam, (2) Betty, (3) Cecil, (4) David and (5 ) Eve. This could be a result of the portal being sorted, or because the underlying relationship is sorted, or because that is the order in which these records were created.

Now let's say you clicked a button in the 3rd portal row, thereby selecting Cecil and storing Cecil's unique ID value in the GlobalContactID field. So far, it all makes sense. But then you say:

2 hours ago, Chrism said:

I also want to use 'Next' and 'back' buttons on the main layout to move to the next record that is displayed on the portal on the left, and use the "go to portal row' to move the portal to the current record being shown. 

So presumably hitting the Next button should select the 4th portal row, the row showing David. But here's the catch: suppose that after you have selected Cecil, David's record is modified so that it no longer passes the portal's filter and now it is Eve's record that occupies the 4th portal row. Or maybe you have selected another group of contacts and now the portal is showing a completely different set of records. What should happen in such case?

IOW, what I am trying to understand is the meaning of going "Back" or "Next" in your scenario. These words have no meaning of themselves, they can only exist in a context of a set of records (be it a found set, or a related set, or a filtered related set) - and none of these sets has a permanent existence.

(BTW, in the scenario I described, the 3rd portal row remains the active portal row until you commit records or click elsewhere. So simply going to the next/previous portal row would accomplish your stated purpose. But I still don't see what practical purpose would be served by this.)

 

Edited by comment
Posted (edited)

Yes that's correct, my contacts table have a fixed order number field, so are sorted this way (1-50 say). I need the contacts display in a pre determined order

In your example,  (1) Adam, (2) Betty, (3) Cecil, (4) David and (5 ) Eve, let's say (4) David was filtered out. So the portal list on the left would contain 

Adam (fixed order number 1) (Get (RecordNumber) = 1

Betty (fixed order number 2) (Get (RecordNumber) = 2

Cecil (fixed order number 3) (Get (RecordNumber) = 3

Eve (fixed order number 5) (Get (RecordNumber) = 4

So the Portal row number data I want is displaying correctly in the portal, I want to get it out somehow to use in the layout

So my next / back buttons use the fixed order number field in the contacts as a way to know which record to go to next and also move to matching record in the portal if the portal record is below the currently portal view, which works fine if the portal is NOT filtered and tracks nicely as I use the 'fixed order number field' as the portal row in 'go to portal row'. (go to portal row next doesn't seem to work?)

But if the portal is filtered, when pressing next it will then go to the wrong portal row as filtered ones are hidden so it doesn't understand that.

So I wanted the Get (RecordNumber)  that is displayed in the portal Contacts_2, to also be in the Contacts table buy some sort of calculation.

The solution is on Webdirect, not sure if that makes a difference.

Thanks!

 

 

Edited by Chrism
Posted (edited)

I still don't understand why you want to do this. If I did, I could possibly suggest a simpler alternative.
 

As it is, I can think of two methods to find the selected record's position in the filtered portal:

1. Loop through the portal rows until the two IDs match.

2. Define a summary field in the Contacts table as List of [ PrimaryKey ]. Place it inside the filtered portal (it can be hidden) and give it an object name (say filteredIDs). Then you can use a calculation =

Let ( [
list = GetLayoutObjectAttribute ( "filteredIDs" ; "content" ) ;
item = Generic::GlobalContactID
] ;
ValueCount ( Left ( list ; Position ( ¶ & list & ¶ ; ¶ & item & ¶ ; 1 ; 1 ) ) )
)

Note that both methods will fail if the currently selected contact is not shown in the currently viewed portal.

 

Edited by comment
Posted

Thank you will give it a try

I simply want to go to the matching portal row, if I change the current contact on the main view

In what table would this calculation live?

Let ( [
list = GetLayoutObjectAttribute ( "filteredIDs" ; "content" ) ;
item = Generic::GlobalContactID
] ;
ValueCount ( Left ( list ; Position ( ¶ & list & ¶ ; ¶ & item & ¶ ; 1 ; 1 ) ) )
)

 

Posted

Thank you, doesn't seem to be working. Still not tracking properly and portal flicking to row further down the portal

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.