11 Replies Latest reply on Jan 6, 2013 2:39 PM by philmodjunk

    Add data from Portal 1 to Portal 2

    Dekade

      Title

      Add data from Portal 1 to Portal 2

      Post

            

           I have three tables: COMPOs, TOPICsCOMPOs, and TOPICs. I also have a TOPICsCOMPOs2 occurrence.

            

           Attached is a view of the relationships.

            

           On the COMPOs layout I have 2 portals. The 1st portal is TOPICs where row by row shows all of the ‘Topic Names’ in TOPICs. That portal is already functioning via a working relationship.

            

           The 2nd portal is TOPICsCOMPOs2. Following in the next paragraph is how information should be created in the TOPICsCOMPOs2 portal.

            

             
      1.           On each row of the TOPICs portal there is an “Add” button.
      2.      
      3.           When clicked the “Add” will run a script that will perform a Set Variable for the particular TOPICs ID number.
      4.      
      5.           The script then takes you to the last row of the TOPICsCOMPOs2 portal.
      6.      
      7.           The TOPICsCOMPOs2 portal field (#1) ‘TOPICs ID’ is filled with the Set Variable.
      8.      
      9.           The TOPICsCOMPOs2 portal field (#2) ‘Topic Name’ has a calculation that pulls over the Topic Name from the TOPICs database.

            

           I don’t think I will have any problem with the script.

            

           It is the relationships that I am having difficulty with. Am I correct in having the 2nd occurrence of the TOPICsCOMPOs table?

            

           How do I get this to work? I’m almost there but yet pretty far away. Could someone help me with this?

           Thanks,

           Dekade

           FMPro ADV 10.0

      RelCopy1a.png

        • 1. Re: Add data from Portal 1 to Portal 2
          philmodjunk
               

                    The 1st portal is TOPICs where row by row shows all of the ‘Topic Names’ in TOPICs

               Don't you mean that it shows all topics that have been selected in the Topics_Compos table? No record from Topics will appear in this portal without a record in Topics_Compos to provide the needed link.

               It looks like you need this set of relationships:

               Compos::anyField X Topics::anyFIeld ---> Double click the relationship line to open a dialog where you can change the = to X.

               Use that portal to list your topics.

               Then use your existing relationship to Topics_Compos to list your selected topics for the current Compos record.

               Now an "add" button in the Topics portal can perform this script:

               Set Variable [$TopicID ; Topics::_pk_Topics_ID ]
               Set Variable [$ComposID ; Compos::_pk_Compos_ID]
               Freeze Window
               Go To Layout [Topics_Compos ( Topics_Compos ) ]
               New Record / Request
               Set Field [Topics_Compos::_fk_Compos_ID ; $ComposID ]
               Set Field [Topics_Compos::_fk_Topics_ID ; $TopicsID ]
               Go To Layout [Original Layout]
                

          • 2. Re: Add data from Portal 1 to Portal 2
            Dekade

                 Kind of but not really.

                 In an old database that I had back in 2008 I had a BOM database (Bill of Materials). Each BOM represented a product containing a number of necessary raw materials. Then I had a Bill of Materials ' BOM Builder' layout. The BOM/B layout had two portals on it.

                 Portal 1 showed a listing of all the Raw Materials; sorted from low number to high raw material 'part' number.That portal came straight from the Raw Materials Database. This portal simply showed every single raw material that my company had. You could scroll down through the portal.

                 I could click on any raw material "Add Button" and that raw material would then be added to a Bill of Materials 'Items' portal (database) [also referenced as Portal #2 for recognition in this forum post]. Various other info was contained on each portal line of Portal #2.

                 Thus for my present needs - I have a Topics portal. It does show each and every Topic Name for that database. Yes - I do have to go to the Topics layout and manually enter a new topic. I will automate that process soon with a script.

                 What I want to do is similar to the BOM mechanism. I want to (buy clicking the 'Add' button) ADD one or more of the topicnames to Portal number 2. Thus I have sort of made a Bill of Materials (Bill of Topics) that henceforth applies to each individual COMPOs. Furthermore, there may be 100 COMPOs (compositions) and each composition has a chosen list of Topic Names displayed via Portal #2.

                 I have this old BOM working model in my possession. It is an error free working model. I'm simply trying to translate that one process within the full BOM model to perform for my present needs.

                 I cannot get that translation conquered.

                 That's what I need help on.

                 Attached is a screen shot of the old BOM Builder.

                 Dekade

                  

            • 3. Re: Add data from Portal 1 to Portal 2
              Dekade
              /files/f19a767aff/BOMB2.png 945x463
              • 4. Re: Add data from Portal 1 to Portal 2
                philmodjunk
                     

                          Thus for my present needs - I have a Topics portal. It does show each and every Topic Name for that database. Yes - I do have to go to the Topics layout and manually enter a new topic. I will automate that process soon with a script.

                     Sorry, but the relationships that you posted in your original post WILL NOT list all topics. It will only list those topics that are already linked to a given record in compos via the join table. You need to check your layout design and see what you actually have set up as a portal to topics from the compos layout CANNOT list all topics without the existance of one linking record in every record of Compos_Topics--which would defeat the purpose of getting a portal to list all topics.

                     What I have posted here should do exactly what you have specified.

                     I can't see the relationships underlying your BOM example, but I would predict that you have a different relationship between your layout's table and CMS Raw Material_Dekade. Instead of the X operator, it may use = match by a pair of fields that have the same value for every record in the layout's table and every record in the raw materials table. Frequently, this is a field that stores or computes to the value of 1 in the match fields for every record in both tables (That's how we did this before we had the X operator and it is still occasionally useful to do it that way.)

                • 5. Re: Add data from Portal 1 to Portal 2
                  Dekade
                       

                            Sorry, but the relationships that you posted in your original post WILL NOT list all topics. It will only list those topics that are already linked to a given record in compos via the join table. You need to check your layout design and see what you actually have set up as a portal to topics from the compos layout CANNOT list all topics without the existance of one linking record in every record of Compos_Topics--which would defeat the purpose of getting a portal to list all topics.

                       I was wrong. Imagine that. I just checked things and you are obviously correct about my relationship being incorrect. I jumped the gun again. So, I guess what you are saying is that this is probably a lot of old school stuff but sometimes still has a place to work; right?

                       I am going to, later on today, work with the instructions of your first post. I think I should be able to get it to work. Yep, I'll be back if I can't.

                       Dekade

                  • 6. Re: Add data from Portal 1 to Portal 2
                    Dekade

                         Yep, you are correct. Imagine that. I didn't look thoroughly enough at what I have. I will try the instructions from your first post.

                         Sorry for the sort of double post. The above reply did not show up for a while.

                         Dekade

                    • 7. Re: Add data from Portal 1 to Portal 2
                      Dekade

                           I am half way there. The portal on the right is correctly displaying all of the topic names in TOPICs. The portal on the left is still not correct.

                      The left portal should have been completely empty before I clicked the + button on any portal row in the right portal; Because there had not yet been a topic assigned to the COMPOs.

                           As can be seen all of the data in the right portal is also incorrectly being seen in the left portal

                           Notice the fourth left portal row. That happened when I decided to try the script on the 'hardship' topic. "10" "Fun" ???

                           I've got something screwed up.

                           Where do I go to correct the problem(s)?

                      IS THERE ANY MEANS BY WHICH TO PLACE MORE THAN ONE .png file per a single 'Post an Answer' ?

                           Dekade

                      • 8. Re: Add data from Portal 1 to Portal 2
                        Dekade
                        /files/1730bcc7a6/Lay1.png 1178x411
                        • 9. Re: Add data from Portal 1 to Portal 2
                          Dekade
                          /files/f4c2796eb3/Lay2.png 1220x419
                          • 10. Re: Add data from Portal 1 to Portal 2
                            Dekade
                            /files/0ec13f2b85/Lay3.png 935x396
                            • 11. Re: Add data from Portal 1 to Portal 2
                              philmodjunk

                                   I think you've indicated that you now have this working in a new thread that you started, but just in case, your relationships and layout design looks correct. This suggests that you have related records in the Topics_Compos table that should not be there or that Topics_Compos 2 is based on a different data source table than it should.