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

Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

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

    Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

    I have an application that uses a tabbed form with several tables that are linked together is a set. The tables are as follows:

    Contact (The parent table)
    + Activities (Linked to Contact by ContactID)
    + Documents (Linked to Contact by ContactID)
    + Counts (Linked to Contact by ContactID)

    The tabbed form has a tab for each table. ContactID is setup to auto-increment in the field rules for the Contact table. This works fine.

    The Activities tab contains a browse called Activities_BR (a browse for the activities table). There is one button on this tab. The OnPush event for this button calls new_record(). When I do this the ContactID in the Activities table is automatically set to the corresponding contactID value in the Contact table. This is the desired action.

    The Documents tab is essentially the same as the Activities tab and works fine.

    The problem is with the Counts Tab. It is structured slightly different.
    The counts tab contains a browse called Counts_BR (a browse for the counts table). There is one button on this tab. The OnPush event for this tab opens a form called "Counts". The form appears to be in record entry mode. This form has various fields corresponding to the Counts table, including CountID and the linking field ContactID.

    The problem I'm having is: When I press this button I'm expecting the ContactID to be automatically populated with the ContactID from the Contact table like it does with the Activities and Documents tables. The obvious difference here is the fact that I'm not directly entering the data into a browse but insetead opening a form to populate the table so it can be viewed in the browse later. Why doesn't the ContactID get automatically entered into the Counts table like it does with the Activities? How do I get that to happen?

    I'm missing something?!? Any help would be greatly appreciated.
    Thanks in advance to anyone who can help!!!

    #2
    Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

    Study the example in the Code Archive Forum called "Pass values between forms". The button which opens the called form should pass the current contact_id field value to the new record in the called form. -- tom

    Comment


      #3
      Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

      Hey Tom, thanks for your help! I looked over the code example you suggested and it could definitely work. However, the example focuses on setting a value in a type-in field on the form. The value I'm trying to set isn't used on the counts form, only in the table. I supposed I could use a hidden field? Why is it that the ContactId isn't automatically entered in the table when I create a new record? It's the linking index?!? When I enter a new "Activity" in my "Activities Embedded Browse table" (without using a seperate form) the ContactId (the linking index) automatically gets entered into the Activities table. When I open the counts form the counts table gets opened also, right? I would love it if, when I clicked on the counts tab in my main form, the counts form opened, the counts table also opened in "Enter Record" mode, and the ContactId from the Contact table/form was entered into the new record in the Counts table. I'm sure this is very basic, I've only been at this for a week and a half and am still trying to grasp the syntax fully. :) Thanks again!

      Comment


        #4
        Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

        Jeff

        I think you have some forms based on the set and the count form based on the table.

        Take a look at this image from AlphaSports. It's in the detail view mode showing the forms for the application.

        Note that the third column shows the table/set that the form is based on.

        If the form is based on the set, the link fields are handled automagically. If based on the table, then the set relationship isn't enforced.

        This also brings up the notion of table/set naming. Be sure to be clear and give a unique name to each. Some people go as far as using a prefix. Ie tbl_client, set_client_activites...
        Al Buchholz
        Bookwood Systems, LTD
        Weekly QReportBuilder Webinars Thursday 1 pm CST

        Occam's Razor - KISS
        Normalize till it hurts - De-normalize till it works.
        Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
        When we triage a problem it is much easier to read sample systems than to read a mind.
        "Make it as simple as possible, but not simpler."
        Albert Einstein

        http://www.iadn.com/images/media/iadn_member.png

        Comment


          #5
          Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

          Thanks Al, you are correct! The question now is... I indeed have my form based on the table not the set. Should I base that form on the set or leave it as is, based on the table? Is there going to be a performance issue? If so and I do base it on the table, what is the syntax to copy the contactId from the Contact table/form to the Counts table? What are my options? I don't really want to use a hidden type-in field on the Counts form. The desired action would be: When I click on the "new count" button, the counts form opens and the ContactId field in the counts table gets populated with the contactId from the Contacts table.

          Comment


            #6
            Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

            Jeff, I think the reason this is not happening automatically is because the "new record" is being entered to the table through the called form. i.e. Your "new record" button doesn't begin the new record in the calling form. It opens the called form and begins it there, right? Alpha Five will not supply the needed link field value because the called form has no connection with the calling form. For all Alpha knows you're opening an unrelated form to begin a new record in a table that is not part of the current set.

            If the calling form remains open, the the ContactId field value is available to the called form, using techniques similar to those I referenced. If this were my app, I'd put the ContactId field in the called form's layout and make it readonly, so the user can't edit it. The techniques I referenced earlier will populate it for you, though you may find you have to modify the selected approach to do it in 3 steps:
            a) release the R/O setting
            b) modify the field value
            c) re-set the R/O setting

            There are other more complicated approaches, but try this first.

            -- tom

            Comment


              #7
              Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

              Originally posted by Tom Cone Jr View Post
              Jeff, I think the reason this is not happening automatically is because the "new record" is being entered to the table through the called form. i.e. Your "new record" button doesn't begin the new record in the calling form. It opens the called form and begins it there, right? Alpha Five will not supply the needed link field value because the called form has no connection with the calling form. For all Alpha knows you're opening an unrelated form to begin a new record in a table that is not part of the current set.
              Thanks again, Tom. Let me see if I understand what you're saying here... Because I'm opening a new form linked to the table itself and not the set (even thought the table is part of the set) Alpha doesn't maintain referential integrity. Am I correct here?

              Is there a way to create another custom form based on the set? I tried this but didn't see any of the fields that belong to my counts table in the list...

              Originally posted by Tom Cone Jr View Post
              If the calling form remains open, the the ContactId field value is available to the called form, using techniques similar to those I referenced. If this were my app, I'd put the ContactId field in the called form's layout and make it readonly, so the user can't edit it. The techniques I referenced earlier will populate it for you, though you may find you have to modify the selected approach to do it in 3 steps:
              a) release the R/O setting
              b) modify the field value
              c) re-set the R/O setting
              I implimented the strategy outlined in the material you referred me to using a hidden type-in text field. Do I still need to set the R/O property if I set the field to hidden? This solution works fine, however, for the sake of understanding and design preference, I would like to know how set the value in the table directly without using a form field.

              There are other more complicated approaches, but try this first.

              -- tom
              I don't mind programming or complex solutions if they will help me to achive my goal. I am an experienced programmer (C,C++,C#,A4 scripting, etc.), just new to XBasic. Thanks again! :)

              Comment


                #8
                Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

                I would like to know how set the value in the table directly without using a form field.
                I'd use the calling form's onInit event to run a script that

                1) gets a pointer to the current table (supporting the called form), using table.current();
                2) checks the mode of the table to confirm it's in ENTER mode;
                3) assigns the calling form's contactId field value to the desired field in the called form's table, using the pointer and dot notation:

                YourTblPointer.yourfieldname = Calling_form_name:ContactID.value (where ContactID is the object name of the object in the calling form that displays the ContactID field. This has the same name as the table field by default, but you might have changed it to something else.)

                The table supporting the called form is opened automatically when the called form opens. The "current record" is read into a buffer automatically. If the form is in ENTER mode the buffer is empty but the fields are ready to be written to. To see a more classic implementation, check the docs for info on <tbl>.enter_begin().

                -- tom

                Comment


                  #9
                  Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

                  Because I'm opening a new form linked to the table itself and not the set (even thought the table is part of the set) Alpha doesn't maintain referential integrity. Am I correct here?
                  I think you'd get the same result (no automatic filling of the child table's link field) if you opened a second form based on the same set. I'm under the impression that each form opens in its own window, and that each window is a separate session. You can have the same form open in two windows and they function independently of each other. User navigation in one does not affect the display in the second. Alpha Five will not supply the link field value across form boundaries. The auto-fill of link field values in related child table records (in the same set based form) occurs whether referential integrity is enabled in the set design or not. For Alpha Five the term "referential integrity" is more commonly used to describe automatic changes in existing link field values (when the parent primary key is changed), or automatic deletion of linked child table records when the parent record is deleted.

                  BTW, welcome to Alpha Five.

                  -- tom

                  Comment


                    #10
                    Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

                    Do I still need to set the R/O property if I set the field to hidden?
                    No. There isn't any way for the user to get to the field to change it's value while it's hidden. Should be just fine. While its hidden the user can't set focus to the field object even if it's still in the tab order for the form.

                    -- tom

                    Comment


                      #11
                      Re: Tabbed form using a set - my linking index doesn't automatically get set?!? WHY?

                      Tom,

                      I think you've answered all of my questions, for now... ;) Thank you sooo much for all of your time. You have saved me hours of research for which I am eternally greatful. I'm currently working (by myself) on porting/redesigning my companies database application that we use to run the entire company from Alpha 4v2. It's a pretty daunting task. In addition to having to work out the design/implementation of the project I'm having to become an expert in Alpha 5 too. So far so good! The genies, tools, and xbasic itself have been fairly intuitive and amazingly powerful. Thanks again!

                      Jeff Walter

                      Comment

                      Working...
                      X