Jump to content

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

Recommended Posts

Posted

Ok...I know I have asked this before...but I really need some help everyone...

I have two tables (FM7) table one is called "Main" table two is called "Policies"

I have a portal on the main page that shows all of the polices for that contact.

What I need is someone to show me how to make a script that will open the Policies table...but here is the trick...when the script opens the policies table I need it to keep the same record or relationship to the main page...this way one someone is on a customer and they want to add a policy to that person only all they have todo is hit this button...and window opens and they fill out the information. they do not have to pick any recoredID or CustomerID it should do this automatically?

Does anyone know how is can be done...Please remember I am just learning...so try to keep it simple...thanks

Posted

Here is what you will need to do.

First: Creat the layout that you want them to go to when they hit the button. Make sure that when you create this layout you select the policies table in the SHOW RECORDS FROM drop down menu.

Next: Create two global fields in your Policies table. One should be a global field to hold the recoredID and the other should be a global field to hold the CustomerID.

Next: Create a new script with the following steps.

1. Set Field (recoredID) with the recoredID from the current record

2. Set Field (CustomerID) with the CustomerID from the current record

3. Open Window. (you can choose the name and size of the window.

4. Go to Layout (choose the layout you created)

5. New Record/Request (this will create a new record in the Policies table)

6. Set Field (recoredID in Policies Table) with the recoredID from the Global Field

7. Set Field (CustomerID in Policies Table) with the CustomerID f from the Global Field

Lastly: Make a button in the main layout with the action "Perform Script" and have it perform the script you just wrote.

This is how I have solved this problem in the past. Hopefully it will work for you as well.

-Kevin

Posted

OK...Let me recap this to make sure I understand:

Table One: I make field names: RecordID & CustomerID -- Both auto serial

Table Two: I make field names: RecordID & CustomerID -- Both Global Fields

On step 1. when you set Field (recordID) this is from table one correct?

On step 2. when you set field (CustomerID) this is from table one correct?

On step 6. when you set field (recordID) this is from table two correct?

On step 7. when you set field (CustomerID) this is from table two correct?

I have done all of this...it does not ssem to be working...is there anythingh I have todo with the relationships...if you can you show me?

Thank you for all of your help....

Joseph

Posted

It will help if you can keep your terminology straight. What you are asking is NOT to open a new table, but to create a new record in an existing table. There is no such action as opening a new table. You can't open something that doesn't exist.

Posted

Joseph31 said:

OK...Let me recap this to make sure I understand:

Table One: I make field names: RecordID & CustomerID -- Both auto serial

Table Two: I make field names: RecordID & CustomerID -- Both Global Fields

Naming fields exactly the same makes it very difficult to keep things straight. So I would suggest naming the global fields gRecordID and gCustomerID.
Posted

Good suggestion...I will rename them to your suggestion...But the example that Kevin gave me still does not work...I must be missing something...maybe in the relationship? Do you have any suggestions...

Posted

Hi Joseph

Using a good naming convention in your files will go a long way in helping you keep things straight in your mind as to what field is doing what. Especially two years from now when someone want's to know what a field is for, or if you ever have to document your file for others. Or, heaven forbid, if something were to happen to you and someone else needs to come behind you and figure the whole thing out.

Here is a link to CoreSolutions Development Inc. who has posted a file called Standards.pdf that can be very helpful when you are first starting out.

HTH

Lee

cool.gif

Posted

Any suggestions? Yes. Hire a developer or take a class or at least post example files with your questions. You're not providing any meaningful information about what you are doing. In effect you are asking us to read your mind. If you're asking for free help you need to be a lot more forthcoming about the details of what you have already tried. For instance you say you have renamed the fields but then you don't describe what your scripts do with these renamed fields.

Posted

ok...no problem...i will get all my information together...and when I think I have a sound and clear question I will post all information...so the forum can understand and maybe help..

thank you

Joseph

Posted

I think I understand what you are trying to do so let me try to point out your problem

Table One: I make field names: RecordID & CustomerID -- Both auto serial

Table Two: I make field names: RecordID & CustomerID -- Both Global Fields

The first problem starts here. You should not have both Auto Serial ID's created in the same table. Instead it should read like this:

Table One (Main table): make field name: MainID -- auto serial

Table Two (Policies table): make field name PolicyID: -- auto serial

and also make field rel_MainID (NOT serial) to hold the ID for the Main file it is linked to.

Now create your global field. (earlier I had you create two, but looking through your example again I think you will only need one.):

Table Two: make field name: glb_MainID -- Global Fields

Make sure your table relationship is as such:

Main File match field (MainID) = Policies File Match field (rel_MainID)

now create your script:

Next: Create a new script with the following steps.

1. Set Field (glb_MainID) with the MainID from the current record

3. Open Window. (you can choose the name and size of the window.

4. Go to Layout (choose the Policy layout you created)

5. New Record/Request (this will create a new record in the Policies table)

6. Set Field (rel_MainID in Policies Table) with the glb_MainID from the Global Field

You should now have records related by the MainID number.

Of course then you have to set your button up to perform this script.

Let me know if this works.

_kevin

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