Dani R Posted April 21, 2006 Author Posted April 21, 2006 can somebody plese tell me how to auto enter to a different table what i put in a another table (i need to take 2 feilds and but the in a different table)?? plese help me!!
LaRetta Posted April 21, 2006 Posted April 21, 2006 Hi dani, Welcome to FM Forums There are two basic ways to accomplish it. Let's assume you have a Customer table and an Invoice table. They are (or SHOULD be) related on the CustomerID. You want two fields in Invoices to 'transfer' from the customer table. Usually redundant data is discouraged (because it can be simply displayed through the relationship by placing the Customer fields directly on the layout). But we will assume this is information from the Customer table which will change over time, such as their Terms or Address. So you need to capture the current Customer info in your Invoice fields. 1) Lookup - Go to your Invoices Terms field (in your Define Fields) and select the Options button. At the top, select Auto-Enter and (at bottom) Looked Up Value. Starting with Table: Invoices and Look Up from Related Table: Customers. Then select the Terms field in 'Copy Value from field.' 2) Auto-Enter - Same as Item #1 (Auto-Enter tab) except (right above Lookup) is Calculated Value. In the calc box, find your Customer Terms field and DOUBLE-CLICK to insert it into your calc definition. It will look like: Customers::Terms. Method 2 seems to be favored in most instances. Let us know if you get stuck. There are many wonderful people here willing to assist you through it. And start reading that FM Manual and become good friends with FM's Help. LaRetta :wink2:
Dani R Posted April 21, 2006 Author Posted April 21, 2006 Thank you very much but ...! How can u seen u a file so a can explain to U what i mean?
LaRetta Posted April 21, 2006 Posted April 21, 2006 Hi dani, You can attach a file here in a response message (zip or stuffit first). Explain in more than just a few words what you want to do. And tell us where to look in your file. Telling us the field names or layout name to reference will also help. We'll help you figure it out. :wink2:
Dani R Posted April 21, 2006 Author Posted April 21, 2006 Hi IF I ENTER in table 1 field_b & filed_c I what to copy it to table 2 field1 & field2 ? Untitled.fp7.zip
LaRetta Posted April 21, 2006 Posted April 21, 2006 You need an auto-enter uniqueID in table 1. This is REQUIRED to create a relationship. And 'transferring' information (via lookup or auto-enter calc) uses this uniqueID to know which record should be used to transfer the information. Once you have a uniqueID in table 1 and THEN you create a record in table 2 and insert the uniqueID from table 1, THEN any lookups (or auto-enter calcs) you've established will fill in accordingly. Here is a more specific example. :wink2: Lookups.zip
Dani R Posted April 21, 2006 Author Posted April 21, 2006 Hi can u have look @ this file please Thank you very much Dani help_me.zip
LaRetta Posted April 22, 2006 Posted April 22, 2006 Hi Dani, Can you tell me the real names for the tables and the fields? Saying Field1, Table 1 etc. doesn't give me a picture to work with. Bottom line ... there usually is no reason to DUPLICATE two fields from one table to another. You have table 2 with field called Index (auto-enter serial). Are you attempting to create an index of table 1? I've returned your file with another alternate method. This one uses 'Allow Creation of Related' which is a checkbox in your graph. If you double-click the = between the tables, you will see this checkbox below. The theory behind 'Allow Creation of Related' is that ... if no record exists in table 2 which matches the h_id in table 1 AND you type a name in table 2 field, it will automatically create a record in table 2 and insert table 1's h_id for you. Notice that (in table 1) the yellow name field is NOT from table 1. I deleted the name in table 1 because you don't need the duplicate. I placed table 2's name on table 1's layout instead. So when you type into the name, it creates a matching record in table 2. But again, I'm only guessing on what you need because I don't know what these tables represent. I will help you through this ... but you need to talk a LOT more, okay? LaRetta help_meREV.zip
Dani R Posted April 22, 2006 Author Posted April 22, 2006 I am training to build a data base for my work that: I have 10 hotels that I have o.t.h in the hotel every month I get from them 2 or 3 night dependent. I ‘m training to keep my eye on who *meny I have left at etch hotel. That first step is that you but in the name of the hotel and who many night. Then I what in the second table what will be the bank of night that I have. I what that it will copy the hotel ID and who many night I have for this month . Step 3 I will get 2 it
LaRetta Posted April 22, 2006 Posted April 22, 2006 Hi Dani, I am still a bit unclear on exactly what you need, but here is another try. So you have 10 hotels. And you receive a list which says how many nights at each hotel. Since you mention dates, I'm including date records in table 2. If this is unnecessary, just remove the date portion from the script and remove the CheckInDate global. When you enter the number of nights, this file will create that number of related records (reservations). As these reservations are used (see checkbox 'Use Room'), they will disappear from the AVAIL portal. Notice (right above) that portal is a toggle between AVAIL and ALL. Your list of hotels to the left allows quick jump to any hotel. The Avail/All button also toggles the count between how many (for each hotel) are available and how many total rooms (reservations) have been made, changing the display and count in the hotels list at the left. You could use ONE field for each hotel count and then decrease the number each time you use a room but that won't allow any history or tracking of your usage. And if dates are important, this method wouldn't allow using specific dates but not others. I don't know if this is a full booking system or a simple tracking of hotels by date or count. You have no Customer table so are YOU the customer? Are we getting closer to what you need? If not, please show me how we need to change it, okay? LaRetta :wink2: ReserveRooms.zip
Dani R Posted April 23, 2006 Author Posted April 23, 2006 hi if is not to mach trouble can u have a look at this file plese? barter2.zip
Dani R Posted April 24, 2006 Author Posted April 24, 2006 Hi LaRetta did u have some Time to have a lock at the file?
LaRetta Posted April 24, 2006 Posted April 24, 2006 You have 3 questions in your file: 1) How do I show a drop down table of all the hotel so I can see the info on the hotel? You are on your Hotel layout. This is where each hotel is created. Why would you need a hotel drop down here? Your hotel_id AND your hotel_name should both be displayed. The hotel_id is automatically created using Auto-Enter serial. The name is typed in by User. If you wish to view (or modify) other hotels, forward/back through the records. You can also provide a portal of all Hotels down the side so you can see what hotels are in your table. Is this what you want? 2)(from NewOrder layout) How do i get the hotel name to make the order. As I indicated in my prior file, the script grabs the hotel_id when you click New Order. It then goes to the Order layout (New Order) and creates a new record. Just eliminate the portion of creating each record as a room (date) if that isn't needed. 3) How do i make a cal to now how neny night? That calc is working fine. Can you explain what you mean here? Do you want it to generate a date for each day listed? That's what my script does - taking the total number of days and creating records. So I'm unsure what you want. I think we are also dealing with language issues here ... I asked questions and see no answers. You have no Client table and that is very confusing. Providing the file is great but I still don't understand the purpose. Have you taken the time to review the logic in the script I provided which shows how you can take Hotel information and create new orders? I haven't given up ... but I feel a bit lost with your short responses. I don't know how to help you. LaRetta
Recommended Posts
This topic is 6850 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 accountSign in
Already have an account? Sign in here.
Sign In Now