Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Portal Sort Upon New Record Create


This topic is 6561 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have an instance where the user needs to create a new record that displays (as one line) in a portal. The position of the record in the portal is determined by a sort on default fields that are set as part of the create script. The sequence I would like to acheive is this:

Step 1: User presses a "Create New" button beside the portal

Step 2A: Script executes to create the record

Step 2B: Script sets the default fields

Step 2C: Script causes the portal to re-sort so the record takes its proper position among others

Step 2D: Script activates the first entry field for the record.

Step 3: User enters the remaining fields directly on the portal row.

I've been able to accomplish all except StepD. How can I locate and activate the new record in the refreshed portal? $Rec=Get(RecordID) and GoTo[$Rec] didn't work.

Thanks for any help.

Posted

Go To Portal Row...

You'd have to run through all the rows in a loop script i.e.

Freeze Window

Go To Portal Row[First]

Loop

Exit Loop If[YourPrimaryKey in the related Record = $Rec]

Go To Portal Row[Next; Exit After Last]

End Loop

Go To Field[Your Field that you want the users cursor to sit in]

I've never tried it, but the above should work.

Might be easier if you sort accross the relationship instead of the portal and then use GetNthRecord() to determine the correct row -- would eliminate flashes and remove the need for the freeze window -- but it's up to you.

Posted

I had this problem and got round it by gathering the information into input fields in a custom dialogue during the new record creation routine.

This of course will only work if you have 3 or less fields that you want to input into the portal but it ended up a rather neat solution for me.

I know that this doesn't answer your question directly. Just my 2c's worth

Phil

Posted

Thanks for the suggestions. You've help me further clarify what the problem reduces down to:

The need for an "Select and Activate for Entry" operation.

The portal accurately reflects the newly-created record -- and displays in in its proper position among the other records.

But there's no direct way to activate it for entry after it's sorted into position, so the user must click on the field to begin entry -- and the same really applies to any existing record in the portal. In other words, there is no simple way to construct a Go To Portal Row [calculated].

I guess I can accept that, but I was just hoping there was a better way.

Posted

Essentially, it's a combination of creation date and a location ID (relative to the particular user).

The result is that a new record takes its place at the end of the group of records for that location -- in a portal that displays results from several locations at the same time.

Posted

That's not very clear. It seems user has to select the location before asking for a new record? From the point-of-view of user, I would ask why can't I fill ALL details in one place.

In any case, if the location of the new record is known, then its position in the portal can be calculated by counting the related records whose parent = current parent AND whose location is ≤ known location AND whose date ≤ today (you will need another relationship to isolate those).

I would go with something simpler, e.g. going to a form layout in the child table.

Posted

... Or allow entry in the top row of a portal instead (create an additional calc field that uses is simply equal to number with the calc: Count( field 1 ; field 2 ; field 3 ; field 4) where fields 1-4 are the fields in the rows in your table. Then sort by that first followed by whatever other criteria you use.

Posted

Comment and Genx --

Sorry if I was a little vague in the details. I was attempting to provide a simplifying example; my actual application involves a more complex portal with some real advantages to keeping the user "in context" while entering their information. Jumping to the top line, the bottom line or a separate layout all fall short of what I'm trying to acheive for the user.

The best summary is that I'm seeking "a Go To Portal Row By Record ID (or Number) function". Since FileMaker knows the portal's current found set, how they're sorted, plus the individual record IDs, it seems there should be a way to get to and work at that level. But certainly, I want to avoid parallel coding the portal's processing.

For now, I've implemented what Genx suggested: loop through all records in the portal to find the one I just created -- and hope I haven't overlooked something in doing that way.

Thanks for the help.

This topic is 6561 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 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.