9 Replies Latest reply: Jun 12, 2012 6:28 AM by Prabodh RSS

    Form6i help inserting a row

    940100
      Hi all,
      I need to know what is the most accurate trigger to do the following:

      I am positioning in record Number1, and i want to go to record Number2, but before reaching record Number2 i want to insert some data in the database being in record number1, and just finishing that code i want to be in the record Number2.

      thx in advance!
        • 1. Re: Form6i help inserting a row
          Prabodh
          937097,

          This is not a good approach. If you start inserting rows into table as the user enters them you are effectively killing the concept of transaction.

          You should be inserting the rows entered only when the user saves the transaction, FORM_COMMIT.

          >
          I need to know what is the most accurate trigger to do the following:
          >

          Does that not depend on other factors like whether your form has at least one block based on a table or not, the block you are referring to is based on table or not, the insert is into a base table or not ,etc.?

          First need to know the events you have and what triggers will actually fire on FORM_COMMIT. Isn't it?

          Regards,
          • 2. Re: Form6i help inserting a row
            850050
            hi,
            I am positioning in record Number1, and i want to go to record Number2, but before reaching record Number2 i want to insert some data in the database being in record number1, and just finishing that code i want to be in the record Number2.
            is the record you are talking is base table block?
            and the table which you want to insert the data based on these records is something else (which is not showed on the screen)?
            if yes for the both of the questions then
            pre-insert is the appropriate trigger to insert the record to other table with respect to blocks records. so that when user commits the current block only the insertion happens.
            • 3. Re: Form6i help inserting a row
              773278
              hi

              try to use pre_insert trigger and after that navigate to the desired one.


              K
              • 4. Re: Form6i help inserting a row
                940100
                Thx all guys,

                I will explain my problem with more detail, but sorry if i don't expalin properly because i don't speak english very well.

                Well, I have one block (N1) wich is the master of another block(N2), and this block N2 is also the master of the block N3.

                The problem i got is that if i travel from one block, record to another i get many errors due to integrity.

                So, what i want to do is every time the focus changes the record and/or block i want to check if the data in the current record is not ducplicated and if not ducplicated, i want to commit that record in DB, and go to the record/block the focus wanted to go; and if the data is duplicated, then i want to stop changing focus and raise a form_trigger_failure so stops the execution.

                thx for help!
                • 5. Re: Form6i help inserting a row
                  Prabodh
                  Hi,

                  <ul>
                  <li>N1, N2 and N3 are based on 3 different tables T1, T2 and T3?</li>
                  <li>Did you build the form using Wizard? Or Manually?</li>
                  <li>Are all the Block Synchronization triggers in place?</li>
                  </ul>

                  Looks like you need to use POST when navigating from a master to detail block.

                  To avoid duplicates check by iterating through each block PK column items , or handle the POST when it fails.

                  Regards,
                  • 6. Re: Form6i help inserting a row
                    940100
                    N1, N2 and N3 are based on 3 different tables T1, T2 and T3?

                    Yes, every block is based in a different table

                    Did you build the form using Wizard? Or Manually?

                    Manually

                    Are all the Block Synchronization triggers in place?

                    Sorry, i don't understand what you mean with Block Synchronization triggers


                    Please, tell me the correct name of the triggers, because when i click "others" to see all triggers avaliable, nothing happens with my Form6i aplicattion :(

                    thx
                    • 7. Re: Form6i help inserting a row
                      Prabodh
                      Block synchronization used in general English context.
                      Consists of Master-Detail triggers (See Form Builder help) and all PRE-BLOCK, POST-BLOCK triggers used to get the desired Detail rows based on a Master row including the DEFAULT_WHERE clause. Not just inserts, but also for Updates and Deletes.

                      It helps to develop M-D forms using Wizard. Maybe you should build one just to see what triggers are generated by the Wizard and how blocks are coordinated.

                      Regards,
                      • 8. Re: Form6i help inserting a row
                        940100
                        Ok

                        I din't understand, i made the blocks manually but the relations using the wizard,
                        so i have the ON-POPULATE-DETAILS and the ON-CHECK-DELETE-MASTER triggers,
                        thx
                        • 9. Re: Form6i help inserting a row
                          Prabodh
                          Good. In which case you will see master -detail blocks coordinated.
                          Look up the POST Built-in, you should be issuing a POST when moving from N1 to N2 and N2 to N3. You do not have to INSERT anything because the N1,N2 and N3 are based on tables and the INSERTs/UPDATEs/DELETEs in the tables will take place automatically when FORM_COMMIT is issued.

                          Perform duplicate checks in N1 when moving from N1 to N2 and in N2 when moving from N2 to N3. Trap the duplicates and raise FORM_TRIGGER_FAILURE when you find duplicates.

                          Hint : Use FIRST_RECORD, NEXT_RECORD, LAST_RECORD,etc.

                          Regards,