Jump to content

Basic Script Help


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

Recommended Posts

  • Newbies

Hi all,

Need some basic script help with FMpro. I'll disclaimer myself by stating upfront that I'm so used to using Access, FMpro is quite different (all most too simplistic??) I have two dbs that I use. In the first DB1, I keep track of my current and ongoing project, each project is assigned a unique number. In the second db, I'll call it DB2, I keep track of my completed tasks for the projects. I've defined a relationship between the project ID# field in both dbs. I know that I've done this part right, because, the second db pulls information (like the project title and due date) from the first when I enter the project # in.

Here's what I'm trying to do:

I want to create a new record in DB2 by click a button in DB1... the new record should automatically pull the project ID# from the current record in DB1. I created the button in DB1 which would perform a the script in DB2 and I've tried to create a script in DB2 that would create a new record and insert the project id# from the last viewed record in DB1. (Is that as clear as mud??). Here's my script, it does step1 and step4, but doesn't pull the project id# at all:

New Record Request

Go to Field [project id]

Insert from Last Record [DB1: tongue.gifroject id]

Go to Field [things to do]

Any thoughts?

Link to comment
Share on other sites

quote:

Originally posted by GuildGirl:

Hi all,

Need some basic script help with FMpro. I'll disclaimer myself by stating upfront that I'm so used to using Access, FMpro is quite different (all most too simplistic??) I have two dbs that I use. In the first DB1, I keep track of my current and ongoing project, each project is assigned a unique number. In the second db, I'll call it DB2, I keep track of my completed tasks for the projects. I've defined a relationship between the project ID# field in both dbs. I know that I've done this part right, because, the second db pulls information (like the project title and due date) from the first when I enter the project # in.

Here's what I'm trying to do:

I want to create a new record in DB2 by click a button in DB1... the new record should automatically pull the project ID# from the current record in DB1. I created the button in DB1 which would perform a the script in DB2 and I've tried to create a script in DB2 that would create a new record and insert the project id# from the last viewed record in DB1. (Is that as clear as mud??). Here's my script, it does step1 and step4, but doesn't pull the project id# at all:

New Record Request

Go to Field [project id]

Insert from Last Record [DB1:
tongue.gif
roject id]

Go to Field [things to do]

Any thoughts?

A better script would be to store your ProjectID in a global field, then goto the related database, create a new record and pull the ProjectID across via a contstant relationship.

------------------

=-=-=-=-=-=-=-=-=-=-=-=-=

Kurt Knippel

Consultant

Database Resources

mailto:[email protected]

http://www.database-resources.com

=-=-=-=-=-=-=-=-=-=-=-=-=

Link to comment
Share on other sites

I think the problem is misuse of the insert from last record step. This is really intended for use in a single file, not between files.

Create a field in each database:

Constant (calculation, number, indexed) = 1

Relate the second file to the first using these fields (ConstRel)

Create a field in the first database:

gTemp (global, number)

Write a script in db1

Set Field (gTemp, Project#)

Perform Script (external,db2,New Related Record)

Go To Field () <-- this returns you to first file.

Write a script "New Relate Record" in db2:

New Record/Request/Page

Set Field (Project#, ConstRel::gTemp)

You could also use a portal in db1 to allow you to see a list of related records in db2 AND create new records by clicking on an empty row (if the relationship is setup to "allow creation of related records").

-bd

[This message has been edited by LiveOak (edited January 24, 2001).]

Link to comment
Share on other sites

One other thought: set up, in DB2, an import where you import whatever field(s) you want from DB1. Then create a script that performs this import.

Now create a script in DB1 with the following steps:

Show All

Omit Record

Show Omitted

Perform External Script

The external script is the one in DB2 that imports. Since it only imports info from the "found set", and since the first three script steps in DB1 create a found set consisting only of the current record, that's all it'll import.

HTH,

Dan

Link to comment
Share on other sites

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