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

Child Record Fields Default from Parent Fields

  • Filter
  • Time
  • Show
Clear All
new posts

  • Child Record Fields Default from Parent Fields

    I'm new to A5. I have a Parent-"Child linked tables, and I need to have some of the fields in the child table default to the values from the parent table. The linked field gets populated when I add a child record (in a browse), but I need other fields to autopopulate as well. Iv'e tried to use the Lookups in the Field Rules to populate several fields, but they do not populate. Should I be using the Field Rules/Data Entry/Default Mode/With some kind of look up function, or am I going down the wrong path and missing an easier way.

  • #2
    RE: Child Record Fields Default from Parent Fields

    My question would be why do you want to store the same data in two tables?
    There can be only one.


    • #3
      RE: Child Record Fields Default from Parent Fields

      I want to use some default values from the parent table based upon the linked field, but then allow the user to change the value in the child table.


      • #4
        RE: Child Record Fields Default from Parent Fields


        I can think of a scenario where I might like to auto populate a child table with data from the parent. Suppose your parent table stores information about an individual...First name, last name, home telephone number, street address, mailing address and so on.

        Now...since each individual can and usually does have more than one telephone number...home, cellular, work and so on, I might create a child table for telephone numbers and link them to the parent with the "Individual ID".

        Now once the parent record is created, I might want to automatically create a record for the telephone number child table which contains the information stored in the "Home Telephone Number" field of the parent. Then as time goes on, I could add other telephone numbers to the child table for the individual.

        Now, how to accomplish the seemingly useless...Walter, if you could elaborate on exactly what and why you are trying to accomplish a solution will most certainly be close at hand. If you could zip up your database and attach it to your explaination, that would be even better.

        Best Regards,



        • #5
          RE: Child Record Fields Default from Parent Fields

          The application is quite largs, and this is only a small part, so let me try to explain a simple example and perhaps I could get suggestions on how to make it happen

          Lets say you have two tables
          Table 1 consists of the following fields

          Table 2 consists of the following fields

          Table1 is the parent and table2 is the child linked by LinkField

          The LinkField gets populated when a new record is added (in my case, in a browse), and I need Table2-"Field1ToBeMod to contain the value from Table1-"Field1, and Table2-"Field3ToBeMod to be populated from Table1-"Field3

          If someone can point me to the place/steps needed to make that happen (or tell me it cannot be done), I can take it from there.

          Thanks for you help


          • #6
            RE: Child Record Fields Default from Parent Fields


            I don't want to start an argument but I fail to understand.

            "I might create a child table for telephone numbers and link them to the parent with the "Individual ID"." - wouldn't that be the time to move the home telephone number out of the parent table to the telephone number table, if only for consistency and ease of maintenance?

            Just a comment, not a criticism, and certainly not suggesting that this is the "only" way.
            There can be only one.


            • #7
              RE: Child Record Fields Default from Parent Fields


              Two ideas to explore:

              1) if you want to try to do this in table field rules for the child table, consider defining a default value expression on the data entry tab. The expression would use one of the lookup() functions to retriev the field value using the current link field value as search key.

              2) if you want to do this on the form use a button script to enter the new child record. that script can assign field values from the current primary table record directly into the corresponding fields in the new child table record.

              -- t


              • #8
                RE: Child Record Fields Default from Parent Fields

                Of course Stan is right but sometimes,whether due to poor design or as a speedup for reporting, it just has to be done. I do it (legacy design) in our key details table, so this is the voice of experience.

                Don't use lookups to populate the child table values. Every once in a while, a single lookup will fail to populate; with more than one lookup a failure is guaranteed particularly if the app is heavily used. Plust the lookus are just slow. With a field rule for default value, those failures may not be noticed right away which can be an even bigger problem.

                I finally solved these issues once and for all by doing the following (which was easier than redesigning the app!):

                I declared a global variable called "BillDetails" in both the parent and child tables.

                The variable is populated in the parent table OnSave event like this:

                BillDetails = padr(alltrim(table.current(1).field1,16)," ")+padr(alltrim(table.current(1).field2),12," ")

                The fields are all padded out to their defined size with spaces. This makes the variable a fixed length string.

                Then, in the child table field rules, matching fields are defined with default values of

                field1 = Substr(Billdetails,1,16)
                field2 = Substr(BillDetails,17,12)


                It's super fast and never ever fails .



                • #9
                  RE: Child Record Fields Default from Parent Fields

                  Oops. That should be

                  BillDetails = padr(alltrim(table.current(1).field1),16," ")+padr(alltrim(table.current(1).field2),12," ")

                  And numeric field can also be include by converting to string in the OnSave and back in the details.



                  • #10
                    RE: Child Record Fields Default from Parent Fields

                    Thanks Tom,

                    The #2 idea did the trick, I just needed to dig deeper for the right On Push Action for the Button (which I named "Add New Record"); I changed the "On Push" event and used the "XBasic Enter Record" item and selected the child table in the "Specify name of Table to Edit" and added the fields to recieve the values in the "Fields to Enter/Edit" then chose "Update field to: Result of an expression" and used the fields from the parent table as the expression.

                    I was suprised that I had to also include the linking field and place the value from the parent table in it, but when I did, the child records then had the proper link value.

                    My form has some fields from of the parent table, the add new record button, and a browse of the child records. Is there a way to automatically refresh the browse to show the new record?