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



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

Auto Populate from Two Tables

  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto Populate from Two Tables

    I have created a form that utilizes a lookup from the table's Field Rules. In this instance the fields (Last, First, FirmCode) are populated by a lookup on the FirmCode pulled from a table called Lwynames. This performs very well.

    I have another table called Lwyfirms that include the FirmCode and Firm name, address, phone, and fax information for that particular firm, and have created fields for each of these fields.

    Right now, the only way I can get the Firm Name, etc. to populate automatically is to have another lookup assigned to the Firm Name field, creating redundancy on the data entry side. Ideally, once the FirmCode field is populated it would automatically pull from the Lwyfirms table and populate the Firm name, address, phone and fax information.

    To reiterate, the form contains:

    1. Table LwyNames fields: AttyLast, AttyFirst, FirmCode
    In the form there is a lookup on AttyLast that populates all three fields. (Attorney Name info)

    2. Table LwyFirms Fields: FirmCode, FirmName, Address, Phone, Fax, Email
    On the (same) form there is a lookup on FirmName that populates the Law Firm info.

    I wish to use the FirmCode (populated when AttyLast is chosen) to populate all the Law Firm information as well as the Attorney Name information.

    Picture attached. In it, the Attorney Name fields are populated and the pop up is the secondary lookup I have assigned to the FirmName field.

    While this will work just fine, I'd like to streamline the process if possible. Any ideas would be greatly appreciated!

  • #2
    Re: Auto Populate from Two Tables

    The real question is why are you duplicating this information? why not create a set of these two tables linked by firmcode 1:1 and have the information presented instead of duplicated? But if you must, place this on the Firmname field OnArrive event.
    dim vFC as C
    vFC = topparent:firmcode.value
    dim t as p
    t ="lwyfirms")
    query.filter ="firmcode = "+quote(vFC)
    	topparent:firmname.value = t.firmname
    	topparent:Address.value = t.address
    	topparent:phone.value =
    	topparent:fax.value = t.fax
    	topparent:email.value =
    Mike W
    "I rebel in at least small things to express to the world that I have not completely surrendered"


    • #3
      Re: Auto Populate from Two Tables

      Hi Mike, thanks for the input. I actually did create a set with the two tables but was unsure how to go from there. You mentioned "have the information presented instead of duplicated?" What do you mean?


      • #4
        Re: Auto Populate from Two Tables

        The form will present the address on the form and the info is always available when needed using the coding similar to what I gave you. See attached example.
        Mike W
        "I rebel in at least small things to express to the world that I have not completely surrendered"


        • #5
          Re: Auto Populate from Two Tables

          I'll try both methods. Unfortunately, for some weird reason, when I copied the database to bring home (its still in the testing stage) it didn't bring the lwyfirms and lwynames tables with it. I'll have to go back in the office later this week to test it. Thanks a million!


          • #6
            Re: Auto Populate from Two Tables

            Hi Mike, I was able to set up the code you sent and edited it to match actual field names. However, I keep getting a script error and I can't figure it out. I've attached a picture of the error and the actual database.

            I tried the method of "presenting" that we talked about, but the client would prefer if I could get this way to work.

            As always, thank you thank you!
            Attached Files


            • #7
              Re: Auto Populate from Two Tables

              Originally posted by kyosadls View Post
              Hi Mike, I was able to set up the code you sent and edited it to match actual field names. However, I keep getting a script error and I can't figure it out. I've attached a picture of the error and the actual database.
              Not quite. That code that is causing the error is trying to capture the value in the field named 'name'. Based on your image, the form Defendantonly is based on the table defendants, which does not have a field 'name'. And none of the others will work either. "topparent" is the parent table of the form. The field name that followestopparent: must be the field name in the defendants table for this form.
              Last edited by Mike Wilson; 06-11-2009, 02:29 PM.
              Mike W
              "I rebel in at least small things to express to the world that I have not completely surrendered"


              • #8
                Re: Auto Populate from Two Tables

                Got it! I renamed the fields in the lwyfirms to match those in the defendantonly table and created a set, then duplicated the form to that set and it works great. I discovered that if I put the code into the FlyOver Event the user doesn't even need to click the field to populate it, which was necessary for the OnArrive Event but I kept it for both Events.

                Mike, has there ever been any talk about setting up a knowledgebase for AlphaFive like that for Experts-Exchange? I tried to find information on this issue here, but I had a hard time finding what I'm looking for and I have to assume that its because its a free service. Don't get me wrong, I'm grateful for it, but would be willing to pay a monthly fee. I very rarely need to submit a question on EE, because I typically can find the solution myself - but then again, system troubleshooting is a much different beast than database programming and I'm not such a novice in that arena. Just a thought.

                As always, thanks for the guidance and support.


                • #9
                  Re: Auto Populate from Two Tables

                  Yes there has been significant talk about such a collection. A little while back it took the course of considering establishing a Wiki-like collection so hat the MB folks could contribute. The problem arises as to who maintains it. Alpha maintains this board. There is another place that you might not know about that has helpful answers - learn That is a collection of how-to's that has a fair amount of resource value.

                  Glad you got it to work.
                  Mike W
                  "I rebel in at least small things to express to the world that I have not completely surrendered"


                  • #10
                    Re: Auto Populate from Two Tables

                    A similar populate problem?...

                    I would like to post or have automatically entered a value in a table field "bank_code".
                    At present, on entering this field a lookup of twelve values 'pops-up' and the user chooses one of the twelve values. The values in the lookup are......... "CH01 through "Ch12"
                    "CH01" represents January and "CH12" represents December.

                    The two tables are 'bank list' and 'purchases_payments'.

                    During the course of data entry, in purchases_payments, four fields require data entry. The four fields are 'check nbr'... 'check date'...'check amount'... and 'bank code'.

                    If the 'check date' field receives the value {08/11/2009}, would it be possible, in lieu of the lookup, to automatically put the value "CH08" in the 'bank code' field .or. if the check date is {09/22/2009} put in "CH09"?

                    Secondly, if this is possible, it must not be an unchangeable calc field!!

                    Reason, It is occasionally necessary to change a bank code value.

                    One example, if a bank code is CH08, it may need to be changed to CH09
                    if an August check clears the bank in September.

                    Hope someone responds, and this is possible. Thanks in advance,

                    John Linley


                    • #11
                      Re: Auto Populate from Two Tables


                      You can code the ondepart event for the check date field to fill the bank code field if it is currently blank with the value you want.
                      Jeff Ryder


                      • #12
                        Re: Auto Populate from Two Tables


                        Try this code on the ondepart event for the date field.

                        You need to change the following object names to the names of your objects: bankcode and checkdate

                        if topparent:bankcode.value=" " then
                        	topparent:bankcode.value = "CK" + padl(ltrim(str(month(topparent:checkdate.value))),2,"0")
                        end if
                        Jeff Ryder


                        • #13
                          Re: Auto Populate from Two Tables


                          Will give this a try this evening. I am reading this code as...
                          if bank code = nothing
                          then put in the value ck + first two digits of the check date.

                          I am used to always using a left parenthisis after an if in an alpha4 conditional expression. I will assume your code is correct and it is not required.

                          These A5 expressions are quite new to me. On occasion, if I write an A4 expresion
                          in A5, it works, but sometimes, perhaps more often than not, it doesn't.

                          Anyway, I appreciate your help and will get back to you and let you know how it is working.

                          Regards and thanks, John Linley


                          • #14
                            Re: Auto Populate from Two Tables

                            As a one line expression uisng if() it would be

                            topparent:bankcode.value = if(topparent:bankcode.value=" ","CK" + padl(ltrim(str(month(topparent:checkdate.value))),2,"0"),topparent:bankcode.value)
                            Jeff gave you a three line code snippet using if..then...else.
                            There can be only one.


                            • #15
                              Re: Auto Populate from Two Tables


                              Yes the code should work as stated as it was tested on a sample form. You are correct in the understanding of the code. I can post the sample program for you to look at if you have any issues.
                              Jeff Ryder