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

how to select portal with script?


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

Recommended Posts

Posted

I have a script to add court charges to a portal, but I must first click into a field in the new portal record, then the script adds the info. It works great but how can I get the script to select the portal by itself? There are a total of three portals on the page. Thanks.

Posted

To "select a portal" you really mean "go to a field in the portal." Tell FileMaker to go to a field in the portal; which tells it which relationship to use. Then go to the Portal Row you want (otherwise FileMaker just goes the first row).

However, portals are primarily data entry and viewing objects for the user, for related records. If you are creating related records via script, you can alternatively create them in the related table without using the portal.

A big question here is: Since you're using a script to create related records, do you even need "[x] Allow creation of related records" turned on? In other words, do people really need to create records directly in the portal?

You could just put a "New Whatever" button above (or next to) the portal, to create the related record, and put them into the desired row and field.

A secondary, less important question: Do you want to Sort the portal?

Posted (edited)

I have re-read your post. So I actually don't need to have a portal that allows creation of records, when I could program a button in my main screen to create a record in the related table (my charges table), as I understand, the portal then would update automatically with the new info. I like this idea better, assuming I understand you fully. My current scripts are very simple. Simplified, I have this for my tables

MAIN TABLE........................CHARGES to CLENT TABLE

client_id_key........................charge_key

client_name.........................client_charged

address...............................charge_amount

calc_field_balance................type_of_charge

fkey_charge

If the button is on the layout for the MAIN TABLE, what do I need in my script to get it to add records to an entirely different table, CHARGES TABLE? I can program the data entry, but how to put it in that other table? And would I pass the client_id_key or name to the other table, and how?

Edited by Guest
Posted

And would I pass the client_id_key or name to the other table, and how

Yes, via a $variable, since you're on fm9! You can place it as autoenter value in the foreignKeyfield, so all you need is:

Go To Layout (child)

New Record

Go To Layout (original)

--sd

Posted

Could your answer be more explicit please? I am new to writing scripts. Could you write a short example of how the variable gets its value and puts it into a field? Tak for lån.

Posted

Try to inspect this template!

http://fmforums.com/forum/attachment.php?attid/12108/

...although it uses the scriptparamter instead is it in principle the same, just initiate the script with the setting of an $variable:

http://www.filemaker.com/help/Script-Steps15.html

--sd

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