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

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

Recommended Posts

Posted

Hello,

I have a file with two related tables: Jobs & Packing Slips. I currently have a script that allows me to create a new Packing slip/Record when I click a button from the Jobs table. Then I type in the corresponding Job Number from my Jobs Table into the Job Number field on my Packing Slip table, which then pulls in the rest of the values I need from my Jobs table onto my packing slip.

I'm wondering if it's possible to modify the script so that in addition to creating a new record for me, it also automatically pulls in the corresponding Job Number from the record in which I triggered the script from. I.e.: I'm in the record for Job# 123, I click the button to trigger the script to create a packing slip for this job, and Job #123 is already in the Job number field on my packing slip without me having to manually type it in.

I'm thinking this has got to be a pretty simple solution, but nothing is coming to me. Let me know if more clarification is needed and thanks much!

Posted

Script for New Packing Slip button on Job Entry Form

Set $jobID to __kP_JobID

Go to Layout Packing Slip

New Record

Set PackingSlip::_kF_JobID to $JobID

Posted

Sorry, I'm very entry level. Would you please add a little more detail/clarification on setting up the script? I see the option to "set variable" but still am not sure how to do it...

Posted

Set Variable [ $jobID ; JobID]

Go to Layout [ layout based upon Packing Slip ]

New Record/Request

Set Field [ PackingSlip::JobID ; $jobID ]

Posted

Thanks, LaRetta. Sorry, mrsw, but I thought that would be enough and I only had a couple of minutes.

Behind this simple script is however, some fundamentally important concepts:

1. Your two tables are related by a primary key (JobID). By populating a foreign JobID key in the Packing Slip table, you are able to look back to the Job record from the Packing Slip record for the related Job data. In the relationship graph you should define a relationship from PackingSlip::_kF_JobID -> Job::__kP_JobID. The prefixes "_kF" and "__kP" are what I use to name foreign and primary key fields.

2. Variables are useful for capturing a value when you need to hold it in memory while you switch "contexts."

3. "Contexts" - where you are in the relationship graph. Are you in the "context" of Jobs or Packing Slips. So, when we say a layout "based on Packing Slip," that is in layout mode, you'll see that in the Layout setup, a table occurrence for Packing Slips is the basis of the Packing Slip layout. That is the context from which that layout will operate.

hth,

Barbara

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