Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Problems Writing Value of Key Field to Child Table

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problems Writing Value of Key Field to Child Table

    I have a dialog component that has two tables in a one-to-one link. The linking field is an auto increment field in the parent table. Data is being written to the child table. But a value of ZERO is being written to the linking field of the child table. Consequently the corresponding record in the parent table is not linked to the child table. The linking field in the parent table is being properly auto incremented.

    Does anyone know how to get the Key Field of the child table written to?

    Thank you,
    CP Good

    #2
    Re: Problems Writing Value of Key Field to Child Table

    take a look at your table definition and data binding if they are good then it should automatically update both tables.
    if still in doubt post back the table structures someone can identify the defect, if any.
    thanks for reading

    gandhi

    version 11 3381 - 4096
    mysql backend
    http://www.alphawebprogramming.blogspot.com
    [email protected]
    Skype:[email protected]
    1 914 924 5171

    Comment


      #3
      Re: Problems Writing Value of Key Field to Child Table

      Thank you for your reply. The issue appears to be with the Key Value being an AutoIncrement field. I have run a test where I have linked the tables on a field whose default value is generated by the api_uuidcreate() function. When I use this field to link the tables it works and not only is data written to the child table (this was not a problem before, data has always been written to the child table) but the key field in the child table was also updated with the linking value from the parent table (this has been the problem when using an AutoIncrement field from the parent table as a linking field).

      I would like to use the AutoIncrement field as a linking field and I feel that I should be able to do so. But I am unable to figure out how to get this to work.

      Thank you,
      CP Good

      Comment


        #4
        Re: Problems Writing Value of Key Field to Child Table

        would you please post table structure you want?
        I think this is the scenario
        table a
        id int auto increment
        rest of the fields
        table b
        id int autoincrement
        rest of the fields
        fk_key int derived from parent table is this correct?
        thanks for reading

        gandhi

        version 11 3381 - 4096
        mysql backend
        http://www.alphawebprogramming.blogspot.com
        [email protected]
        Skype:[email protected]
        1 914 924 5171

        Comment


          #5
          Re: Problems Writing Value of Key Field to Child Table

          Hi,

          Thank you for continuing to work with me on this. I believe you may have the Table B field rules incorrect. Here is the structure of the Parent and Child tables:

          Parent:
          User_ID, N, 10,0 autoincrement
          User, C, 30
          PW, C, 30

          Child:
          User_ID, N, 10,0
          User_First_Name
          User_Last_Name

          The Child table has "NO" field rules. These are DBF tables. In the dialog component table definitions the Parent and Child are linked on the User_ID field. The primary key for each table is User_ID. Data is saved to the Child table but the User_ID field always contains ZERO (not NULL). The User_ID field in the Parent table is properly autoincrementing.

          For instance, I just entered a record and the Parent.User_id=1632 the Child.User_id=0.

          Thank you,
          CP Good

          Comment


            #6
            Re: Problems Writing Value of Key Field to Child Table

            this won't work. you need connecting linking field in the parent to the child other than the primary key of the parent and the child table primary key also should be auto increment.
            parent
            user_id, n, 10,0 auto increment
            user, c, 30
            pw, c, 30
            linking_field to the child n, 10,0 (link to primary_key)

            child
            user_id, n 10,0 auto increment
            user_last_name c, 30
            user_first_name c,30
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


              #7
              Re: Problems Writing Value of Key Field to Child Table

              on the other hand if you must follow what you have, the ux will not be able to do but you can do by writing a short code after insertion.
              after insertion get the primary key then insert into the child table yourself.
              if you are not able to figure this out post back I will show you how.
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


                #8
                Re: Problems Writing Value of Key Field to Child Table

                here is the screencast, take a look:
                http://screencast.com/t/ydi3c0uAZVUJ
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: Problems Writing Value of Key Field to Child Table

                  Hi Govindan,

                  I love that script and it works great if you are only submitting to one table. What if you are submitting data to both tables, is there a way with that script to overwrite the previous entry in the user_id field of the user2 tables after the submit has been completed?

                  Comment


                    #10
                    Re: Problems Writing Value of Key Field to Child Table

                    Originally posted by bustamorg View Post
                    Hi Govindan,

                    .... What if you are submitting data to both tables, is there a way with that script to overwrite the previous entry in the user_id field of the user2 tables after the submit has been completed?
                    why?
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: Problems Writing Value of Key Field to Child Table

                      Because in my tables there is the customer table with the PK of cust_ID, and then I have a complaints table that I have the cust_ID in it as a foreign key and that is how I am trying to link the tables together. When I use that script, since that field is already populated it moves that number down and starts a new row and puts the value there. They are being populated by the dialog and are updating the tables simultaneously. If there is a better way of linking the tables I would love to know it has been driving me crazy for a few days now.

                      Comment


                        #12
                        Re: Problems Writing Value of Key Field to Child Table

                        you should not use that script in your case. please go back read the entire thread, this is done an unnatural way to accommodate original post.
                        in your case just list both tables in a dialog it will update properly. if still not able to do, post back your tables I will show you how.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment


                          #13
                          Re: Problems Writing Value of Key Field to Child Table

                          Great thanks because I can not figure it out. Here are my tables the customer table is the primary table. I am trying at this point o get the cust_id into the complaint table without having to do it manually.
                          Attached Files

                          Comment


                            #14
                            Re: Problems Writing Value of Key Field to Child Table

                            http://screencast.com/t/rETHZJ0ick
                            take a look
                            thanks for reading

                            gandhi

                            version 11 3381 - 4096
                            mysql backend
                            http://www.alphawebprogramming.blogspot.com
                            [email protected]
                            Skype:[email protected]
                            1 914 924 5171

                            Comment


                              #15
                              Re: Problems Writing Value of Key Field to Child Table

                              Thank you so very much Govindan, it looks as though I was making this out to be a lo harder than it needed to be. I really appreciate he time that you have taken to help me through this issue.

                              Comment

                              Working...
                              X