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

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

Recommended Posts

Posted

Hi there,

I'm using a portal in my database which I wish to automatically populate with some data (roughly the same data is looked at for each record for which the portal exists). This data may be wanted to be deleted or changed by whoever is entering it however.

I do have a value list containing everything I need to be in this portal.

Would the proper way to go about doing this be make a script which, on creation of each record, populates the fields which the portal is drawing from with the auto-enter data?

If so, how would this script work?

Thanks a lot!

Michael

ps

If you need to see my file to understand this better, let me know.

Posted

ok. Here's an example, suppose you have a layout with a portal on it. Let's say the layout contains a field for a parent and the portal contains records from a child table, which contains the children of the parent.

for example, in the parent_table, you might have the following fields: PkId - primary id, serial

parent_Name - name of the parent

in the child_table you would have

the following fields:

UID - unique id serial

fkId - foreign key, which is what is related to the pkId.

child_Name - name of the child

i know not very creative, but i'm trying to keep it simple here.

Assuming you have these 2 tables and a layout which contains a field for parent name and a portal which contains , at least, the child_Name from the child_table, you should be able to use this script as an example

let's say you have a button on the layout which will create a new record and pre-fill the portal with some records

# script to add new parent record

# and insert a few pre-fab child records in the portal

#

# insert new record for parent

New Record/Request

# put some data in the parent_name field

Set Field [parent_table:parent_name; "Fred Flintlock"]

# move to the first row in the portal (this works

# even if you do not have a row in the portal yet

Go to Portal Row [select; First]

set Field [child_table:child_name; "Bam-Bam"]

# go to next row in portal

Go to Portal Row [select; Next]

set Field [child_table:child_name; "Pebbles"]

# now go back to parent field

Go to field [parent_table:parent_name]

####

hope that helps,

sincerely

J__

Posted

Thanks for your response!

My solution turned out to be similar.

Here it is, for reference sake.

Set Variable [$ItemNum; entry layout::Item Number]

Go To Layout [input layout (input layout1)]

Loop

Set Variable [$InputLooper; 1+$InputLooper]

New Record/Request

Set Field [input layout::Item Number; $ItemNum]

Set Field [input layout::Measured Amount; Case ($InputLooper = 1; "First Amount"; $InputLooper = 2; "Second Amount"...)

Exit Loop If [$InputLooper = 10]

End Loop

Go To Layout [entry layout (entry layout1)]

Thank you,

Michael

  • 2 months later...

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