Jump to content

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

Recommended Posts

Would someone please write a clear, concise tutorial in layman's terms for the Set Field script step?

Or at least point me in the right direction. I have searched this forum and the entire Internet along with every book I have from v.7 to v.11 trying to understand this step.

I am trying to get away from copy/paste and all I want to do is copy the data in a field then go to a different layout and paste the same data into the same field.

IE; I have a table named Hotels which contains an auto-generated serial number field (HotelSerNum_pk). I also have a layout for printing commission invoices for said hotels. I have placed (and removed) and re-placed the same field into this layout and nothing seems to work.

When I tried placing the field on the commissions statement layout and using Find/Perform Find it kept coming up with no matching data and Modify Find. I would manually put in the S/N and it worked perfectly. FMP just will not auto-enter the data in the field for me.

I cannot for the life of me figure out the correct parameters and/or calculation steps to do this.

I only want to do one record at a time, not multiples.

If someone could please take the time to explain this step, I myself and I'm sure a multitude of other knuckleheads like me would be indebted to you.

As always, thanks in advance...

Link to comment
Share on other sites

I have a feeling this has nothing to do with Set Field[] script step - which is VERY simple to use: select the field to set and (optionally) the field's repetition, then specify the value.

I have a table named Hotels which contains an auto-generated serial number field (HotelSerNum_pk). I also have a layout for printing commission invoices for said hotels.

This layout - what table does it show records from?

Link to comment
Share on other sites

This layout - what table does it show records from?

It actually shows records from the Accoms Table which is related to the Hotels table through a lookup.

I tried changing the field on the Commissions Invoice from the Hotels::HotelSerNum_pk field to the Accoms::HotelSerNum_fk field but got the same results.

Link to comment
Share on other sites

It actually shows records from the Accoms Table which is related to the Hotels table through a lookup.

No table is related to another "through a lookup". I am really confused regarding what are you trying to do - and in what context.

I have a table named Hotels which contains an auto-generated serial number field (HotelSerNum_pk). I also have a layout for printing commission invoices for said hotels. I have placed (and removed) and re-placed the same field into this layout and nothing seems to work.

Hopefully, you are NOT trying to modify the field Hotels::HotelSerNum_pk - no matter on which layout. If you were to succeed in this, all relationships of that hotel - based on the hotel's unique serial number - would break.

Perhaps you are trying to create a new related record in the Accoms table? If so, the field to set would be Accoms::HotelSerNum_fk (using you naming convention).

Link to comment
Share on other sites

No table is related to another "through a lookup". I am really confused regarding what are you trying to do - and in what context.

Sorry, bad wording on my part.

Hopefully, you are NOT trying to modify the field Hotels::HotelSerNum_pk - no matter on which layout. If you were to succeed in this, all relationships of that hotel - based on the hotel's unique serial number - would break.

No, these fields are not modifiable.

Perhaps you are trying to create a new related record in the Accoms table? If so, the field to set would be Accoms::HotelSerNum_fk (using you naming convention).

This may be where I'm going wrong. I'm not trying to create a new record. I'm trying to print a report.

Let's try another one where I am getting the same results.

I have a report named InfoMax that lists all the hotel information for several days.

As you can see below, the report is generated from the Hotels table which has a field for Tours::TourSerNum_pk. The InfoMax layout also contains a field for Tours::TourSerNum_pk.

By creating a Find using copy/paste, I can produce a report showing all the records for that given tour.

Here is the script and the error message;

InfoMaxSnip.pngInfoMaxError.png

I can click Modify, enter the TourSerNum_pk in the corresponding field on the InfoMax layout, continue the script and get my report.

Link to comment
Share on other sites

You script illustrates that you have not carefully read Comment's statement.

There are two parts to the set field statement; and therefore two "Specify" buttons. You are only doing part 1.

You must:

1. Specify the FIELD that you are going to set.

2. Specify the VALUE that you are going to set.

You have not done part 2.

In your script, you will need to set a variable to the Tour pk.

Go to correct layout.

Enter find mode

Set the field to the variable.

Perform the find

In the attached example, the State field is being set to "WA"

Set field.png

Link to comment
Share on other sites

  • 3 weeks later...

For the life of me I cannot figure out where I am going wrong with this. I have searched, read and tried everything I can think of. Now I am thinking that "Set Field" might not be the step I need.

Below is a snip of a script that works but I really want to do away with the copy/paste part.

ContractInfoSnip.png

I tried a script from the Missing Manual book that is mentioned on page 419 under Building Your First Script. I used this to find records that had balances due and it worked perfectly. It just never left the main layout page and I did not try to build a report from it.

The instructions for that script had me use a calculation of Hotels::Discrepancy:[>0].

Once again, all I want to do is single out the record in question and uses the data from the fields in the Hotels Table to print a report (ContractInfo). Is there something that I am overlooking here or am I trying to use the wrong script step?

Comment, you had mentioned studying the "Go to Related Record []" script step. All the related records show up in the aforementioned report. This report only references records in the Hotels Table. Namely the "HotelID" field.

Link to comment
Share on other sites

Comment, you had mentioned studying the "Go to Related Record []" script step. All the related records show up in the aforementioned report. This report only references records in the Hotels Table. Namely the "HotelID" field.

I am afraid I cannot follow that - or your script. You go to a layout of Shows and grab a related value Hotels::HotelID from there. Since we don't know the relationship between Shows and Hotels, and we don't know which record in the Shows table you happen to land on...

Link to comment
Share on other sites

I am afraid I cannot follow that - or your script. You go to a layout of Shows and grab a related value Hotels::HotelID from there. Since we don't know the relationship between Shows and Hotels, and we don't know which record in the Shows table you happen to land on...

This is the Main Page layout that contains the records from the Shows Table. The whole tour is based on the shows it contains. Other than that, the records in the Shows Table are of no use here. The hotels have no need for any of the information related to the shows themselves.

The fields from the Hotels Table are located on this layout and related via Shows::ShowSerNum_pk > Hotels::ShowSerNum_fk. Each hotel has a unique HotelID number that is not used as a key field. Only a reference. The key field for the Hotels Table is HotelSerNum_pk. There are also other related tables with data showing up on that layout that are related to the Hotels Table through the HotelSerNum_pk field.

I am starting the script from the Main Page [shows] layout and I am trying to use the HotelID field as a reference because of it's simplicity. IE: a single hotel for the June 11, 2011 show would have the HotelID of 061111. This way, if there are multiple hotels for a show then each one can have a unique yet simple reference. Example being 061111A for the artist's hotel, 061111B for the band's hotel, 061111C for the crew hotel, etc.

I am needing the script to go to the HotelID field that resides on the Main Page [shows] layout, copy the HotelID and then find that record so that the user can press a "Print Contract Info" button and the ContractInfo report can be printed.

What else can I provide you with to help you understand what I am trying to do? I don't know how to verbally simplify it any further.

Link to comment
Share on other sites

related via Shows::ShowSerNum_pk > Hotels::ShowSerNum_fk

Huh? Don't you mean = (equal)?

I am starting the script from the Main Page [shows] layout and I am trying to use the HotelID field as a reference

The problem here is that if the show has more than one hotel, your script will ALWAYS grab the ID of the first one only.

Link to comment
Share on other sites

Huh? Don't you mean = (equal)?

Sorry, I'm not good at Filemaker-ese. I'll get there though as soon as I get the more important stuff figured out.

The problem here is that if the show has more than one hotel, your script will ALWAYS grab the ID of the first one only.

I don't see that being a problem. Each hotel will still have it's own SN and be related to the show in question. I still would be able to print a unique ContractInfo report for each hotel.

Link to comment
Share on other sites

I still would be able to print a unique ContractInfo report for each hotel.

Not by using the logic in your script. It will ALWAYS search for the FIRST hotel related to the show.

Why don't you use a portal to Hotels placed on the Shows layout? Then you can have a button in the portal defined to Go to Related Record[].

Link to comment
Share on other sites

Not by using the logic in your script. It will ALWAYS search for the FIRST hotel related to the show.

Why don't you use a portal to Hotels placed on the Shows layout? Then you can have a button in the portal defined to Go to Related Record[].

I see where are coming from (I think). The hotels portal will eventually have over 50 fields. Let me try to put a few of them into a portal and see what happens.

Let me ask you though, with 50 fields they are not all in a straight line top to bottom. They are scattered over the interface which will make for a very large portal. I already have a portal on the Main Page interface for accommodations as well as portals for hotel support personnel, tour vehicles and revenue collection. The portals for hotel support, vehicles and collections are in a tab control. Question is can I place the accommodations portal and possibly the tab control on top of the hotels portal and everything still work?

Thanks for all your help.

Link to comment
Share on other sites

50 fields in a portal?! Even with only 5 rows - that would be 250 pieces of data. No human can possibly make use of that. Portals are designed for quick overview and selection. To view a record in detail, go to its own table (as suggested above).

I didn't get the part with the tab control being "on top".

Link to comment
Share on other sites

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