Jump to content

Next Prev record in one row portal


RSGC

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

Recommended Posts

Hi, I hope this has not been answered many times.

My (seemingly?) simple problem: I have a parent/child relationship, and in the vast majority of cases there will be only one child. But there will be cases when there are two, three, or more child records, and those need to be accommodated. The chance of the number of child records growing to a large number (more than 3 or 4) is VERY slim.

There are about 10 specific fields fields for each child, and a notes field. As in most cases it will be a 1 to 1, I am hoping to have a portal with all these fields for one record showing on my layout (like a little "standard layout" with the main layout). Then place buttons to do things, like add another child record, go to the next child record, go to the previous child record, etc.

I have the portal setup, and it is showing the appropriate first child record. And there are multiple child records created (if I delete one, the next in order shows up too!). I have tried two things for next/prev buttons so far:

1) I tried setting the buttons to the script step "Go To Portal Row Next" or "Go To Portal Row Previous" recognizing there was technically not another portal row to GOTO, hoping it would increment the record. It does not, at least how I have implemented it. Seemed simple, but no go.

2) I made a simple script "GotoChildNext" with the steps:

- Go to related record

- Go to Record Next

- Go to Layout Original Layout

Again, hoping for the best, but this is not incrementing the displayed record either.

I have the buttons "inside" the portal, thinking that would indicate to FMP which portal to affect.

BTW, I am on FMP 10 advanced at the moment.

Thanks for any pointers on this.

Bob

Link to comment
Share on other sites

  • 3 weeks later...

Hi -- great solution. I have so much to learn. Sorry for the delayed response, just back to this project after too long a delay. As a follow up, what would be the best process to add a new child record. I have a button on the form that I can make work with a script that:

copies keyID form parent

switches to child form

new record

paste parent keyid into appropriate field

goto original layout

I do a couple other things in there, but is there a way to avoid the copy/paste that is not obvious to me. Unless I missed something there is no portal anymore (I know you had one on the example, but for simplicity of interface thinking I will eliminate that. I don't find a "create child record" script step, but maybe there is another way?

Thanks so much for your prompt and significant help!

Bob

Link to comment
Share on other sites

Copy and paste are not suitable for tasks like this because the clipboard is under the control of the user, and this introduces risks and vulnerabilities into the process:

1) copy and paste require the fields to be on the current layout, which is not always possible or desirable;

2) the copy process destroys the current contents of the clipboard, which the user might have been relying on for their tasks

3) the user can change the clipboard at any time, and this may interfere with a filemaker process.

Imagine setting off a long script and putting FMP in the background while you do some work in another program. You copy some text to the clipboard... what will this do to the script running in the background?

Link to comment
Share on other sites

Thank you -

I've always been intimidated by the idea of placing a 2nd occurrence of the same table...

2 parts are not working for me. Any idea what I'm doing wrong?

1. the value of N does not appear on my form (edit: I can get the field to show as 1, but not the subsequent records)

2. when I move my cursor from the first child record to the 2nd child record, the data on the right hand side doesn't change.

Also, I don't understand what the global field titled - is for or how it's used

Thank you -

Marion

Is the rectangle around the child record anything special? Or is it just a rectangular shape?

Edit: ahhh - there's a script going on in there. Maybe I can figure it out.

Edited by Guest
Link to comment
Share on other sites

I've always been intimidated by the idea of placing a 2nd occurrence of the same table...

Then you have been missing a very powerful feature.

Any idea what I'm doing wrong?

I'm afraid I cannot troubleshoot your file without seeing it (even if I wanted to ;) ).

Also, I don't understand what the global field titled - is for or how it's used

It's only a separator - it serves no real function in the demo.

Is the rectangle around the child record anything special? Or is it just a rectangular shape?

It's just a rectangle.

Link to comment
Share on other sites

Try placing fields from the "Licnese 2" TO in the designated area?

BTW, I am not sure what you are trying to achieve here. If all you want is to view more details of the portal record, then this technique is not the best one - you'd better look at:

http://fmforums.com/forum/showtopic.php?tid/196128/

Link to comment
Share on other sites

That worked much better.

Now I need to surf and learn how to add a child record from this screen....

I read "You should use script variables or script parameter (also a form of a variable) to load the data you need, and the Set Field[] script step to put it where it belongs."

But I need a more explicit tutorial or example to follow.

Link to comment
Share on other sites

  • 4 weeks later...

Hi to those that responded to my question. I appreciate the fact that using copy/paste is NOT a good idea, which is WHY I asked for other options. I have been using FMP for years, since the name was just Filemaker. but, unfortunately just casually, and script variables were not part of the product then, and their existence had slipped by me. I have used globals as sort of variables in the past, and did not think of their use for this. I will look into script variable and figure out what they are all about. Thanks!

Bob

Link to comment
Share on other sites

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