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

Open child form with filter based on one indexed, one non-indexed fields

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

    Open child form with filter based on one indexed, one non-indexed fields

    How do you open a child form to display records that
    match two different fields on the parent form?

    This simple question has burned up most of my Saturday with no resolution, hence this posting.

    A set has been defined between the parent and child tables for a 1:M relationship with the link of Topic_Id

    I expected this to be somewhat straightforward, but after spending the this morning and afternoon experimenting, seek the guidance of someone who knows what they're doing.

    Parent table
    Code:
    Topic_ID
    Question_No
    Topic_Memo
    Child table
    Code:
    Topic_Id
    Question_No
    Question_Memo
    Topic_Id is indexed in both tables.

    Question_No is NOT indexed for either table. Only occasionally will the child records need to be selected based on a field other than Topic_Id.

    When I press a button on the parent form I would like to open the child record with both the same Topic_Id and Question_No as the parent.

    I'm using an Action Script to do this, so getting there HALF way is fairly simple.

    Here's what I've entered for the Open Default Form or Browse Action Script:

    Code:
    Selection criteria "Records that match the value in a control on the current form or report" 
    Show records where the value in the field TOPIC_ID
    Matches the value in the control TOPIC_ID
    The correct child records are displayed. So far, so good

    But how do I select the one child record that has the same value of Question_No as the parent?

    Is it possible to specify TWO selection criteria using the script genie, that is finding the records using the match on Topic_id, then using "Records selected fy a filter expression" to select from the returned child records the one form that also matches Question_No. Sounds like a reasonable approach, but I couldn't make it work.

    So I guessed we're supposed to use the Records selected by a filter expression option.

    I tried first just to filter the child records on one field, then on both fields. I never made it to second base.

    In the Expression builder I created the following expression just using the F2 keys.

    Code:
    TblChild->Topic_id = Topic_id
    Note that I allowed Alpha to generate the expression, but I thought it curious that there was no table reference on the right side of the equation.

    The filter failed; all records were returned not just the child records corresponding to the parent's Topic_Id.

    Next I edited Alpha's filter to the following
    Code:
    tblChild->Topic_Id = tblParent.Topic_Id
    which resulted in the error message:
    "Invalid filter expression: TblChild->Topic_id = tblParent.Topic_id"

    So I figured that the normal way of specifying a table.field must not apply to these filters so I replaced the period with -> as follows:
    Code:
    tblChild->Topic_Id = tblParent->Topic_Id
    and you guess it got another error message:
    "Invalid filter expression TblChild->Topic_Id = tblParent->Topic_Id"

    I'm running out of alternatives. Can someone help me see the error in my ways?

    Bob McGaffic
    Pittsburgh

    #2
    Re: Open child form with filter based on one indexed, one non-indexed fields

    There's got to be a better way.

    I tried another approach and solved the problem although somewhat clumsily. I should would like to hear from forum members who see a cleaner way of doing this, without resorting to the use of intermediary variables.

    Also I would still appreciate any insights as to why the filter expressions I used in my previous post all failed.

    When you open a form, does Alpha Five open the new form (thus changing parentform) and then filter the records or does it select the records first by a find or a filter, then open the new form?

    Here's what I did that worked:

    I defined global variables for both
    mTopic_Id
    mQuestion_No

    I then populated these variables on the parent form.

    Next I used these variables to open the child form with Records Selected By a Filter Expression.

    Here is the filter that worked:
    tblChild->Question_No = Var->mQuestion_No .and. tblChild->Topic_Id = Var->mTopicId

    Bob McGaffic
    Pittsburgh, PA
    Last edited by rmcgaffic; 03-21-2009, 07:40 PM.

    Comment


      #3
      Re: Open child form with filter based on one indexed, one non-indexed fields

      Bob, give us some sample data. You ought to be able to do this without using global variables. -- tom

      Comment


        #4
        Re: Open child form with filter based on one indexed, one non-indexed fields

        If you want an approach that does not involve variables:
        Link the parent to the child using an expression instead of a field.

        The expression would be:
        padl(Topic_Id,10, "0")+padl(Question_No,10, "0") ...if these fields are character, or:
        padl(str(Topic_Id),10, "0")+padl(str(Question_No),10, "0") .. if both are numeric.

        In the above expression, I used 10. Change as appropriate.

        A form based on this set will show child records matching a parent with the same topic_ID and same Question_No

        If these expressions seem unduly complicated: it's for a reason.
        The reason?
        As Jack Palance would say: That's for you to figure out.

        Of course there is a myriad of other ways to do this. For now, let's start with the basics.

        Attempting to answer the other questions without the context is crapshoot.
        Last edited by G Gabriel; 03-22-2009, 07:43 PM.

        Comment


          #5
          Re: Open child form with filter based on one indexed, one non-indexed fields

          Tom, Attached is a test database of 1 parent record and 5 children records per your request. It is a test of your current event's knowledge.

          G, I'll try your suggestion tonight.

          Thanks to both of you.

          Bob McGaffic
          Pittsburgh

          Comment


            #6
            Re: Open child form with filter based on one indexed, one non-indexed fields

            Not sure about the genie. Here's a one line inline xbasic solution.
            There can be only one.

            Comment


              #7
              Re: Open child form with filter based on one indexed, one non-indexed fields

              And here's an approach using Action Scripting (though a tiny bit of inline xbasic was used, also.) -- tom


              Later on ...Stan's approach sets a basequery in the called form. User cannot "ShowAll" records. This is probably a good thing in Robert's app. My approach does NOT set a basequery, but runs a simple query instead. ShowAll is active in the called form, using my approach.
              Last edited by Tom Cone Jr; 03-23-2009, 12:01 PM.

              Comment

              Working...
              X