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

Child Record for Each Parent Record

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

    Child Record for Each Parent Record

    I have an application with a parent table and several child tables, all one-to-many. I am trying to figure out the best way to set up the application so that a user can enter -- at the same time -- the same record in one particular child table for most of the records in the parent table. The parent records in question would have a simple filter (whether a logical field is .t.). Each record in the child table would have the same data in three fields (one date and two character fields). Any scripts need to be created through action scripting.

    Can someone help or point me in the right direction or thread(s)? Thanks.

    #2
    RE: Child Record for Each Parent Record

    Herbert,

    Use field Rules. When a new record is entered the fields would be filled with the default values.

    RegardsKeith HubertGuild MemberLondon.KHDB Management Systems
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      RE: Child Record for Each Parent Record

      Herbert,

      In pseudo code this would mean:

      a) getting the field values from the user, perhaps storing them in variables.

      b) opening the set

      c) running a query to display only those records you want for which you want to create new child table records

      d) fetching through the parent table one record at a time

      e) as each new record is fetched enter a new record in the child table, supplying field values from the variables

      f) continue until there are no more records in the parent table to fetch

      I don't know if this can be one entirely within Action Scripting.

      -- tom

      Comment


        #4
        RE: Child Record for Each Parent Record

        Tom,

        Thanks for the response. Unfortunately, I know very little about Xbasic and have been working exclusively with Action Scripting.

        I've tried creating a script (using Action Scripting, of course) for a button on a pre-existing form that is based on the set, with an embedded browse on the form based on the child table. So far, the steps on script is as follows: (1) Run a saved query; (2) Using an XDialog box, prompts the user for information and stores it in three variables; (3) Enter new record in embedded browse; (4) Set value in fields with the data in the variables; (5) Save Record; (6) Next record. But after this I basically got stuck -- I am not sure how to make it continually enter a child record for each parent record in the query. I was thinking about perhaps putting some sort of condition in the last couple of steps to have the script continue entering new records until there's a child record for each parent, but really have no idea what kind of condition to set or whether it is even possible.

        I've also thought about having a script that would first run some saved operations. The first operation would copy the ID numbers (the linking field) that I need from the parent table to a new table. The next operation would be appending this new table to the child table. Then I could have the script enter the data from variables in each record where there is an ID# but no data in the other fields.

        Even if I knew exactly how to implement these two ideas, neither seems ideal (particularly the second one). Any ideas? I am assuming it would be easier in Xbasic.

        Comment


          #5
          RE: Child Record for Each Parent Record

          Tom,

          Thanks for the response. Unfortunately, I know very little about Xbasic and have been working exclusively with Action Scripting.

          I've tried creating a script (using Action Scripting, of course) for a button on a pre-existing form that is based on the set, with an embedded browse on the form based on the child table. So far, the steps on script is as follows: (1) Run a saved query; (2) Using an XDialog box, prompts the user for information and stores it in three variables; (3) Enter new record in embedded browse; (4) Set value in fields with the data in the variables; (5) Save Record; (6) Next record. But after this I basically got stuck -- I am not sure how to make it continually enter a child record for each parent record in the query. I was thinking about perhaps putting some sort of condition in the last couple of steps to have the script continue entering new records until there's a child record for each parent, but really have no idea what kind of condition to set or whether it is even possible.

          I've also thought about having a script that would first run some saved operations. The first operation would copy the ID numbers (the linking field) that I need from the parent table to a new table. The next operation would be appending this new table to the child table. Then I could have the script enter the data from variables in each record where there is an ID# but no data in the other fields.

          Even if I knew exactly how to implement these two ideas, neither seems ideal (particularly the second one). Any ideas? I am assuming it would be easier in Xbasic.

          Comment


            #6
            RE: Child Record for Each Parent Record

            I found a script in the code archive and modified it for my needs as best as I could. This is what I have:

            t=table.current(1)
            c=table.current(2)
            query.description="Solicit_Query"
            query.order=""
            query.filter="Solicit = .t."
            query.option="M"
            idx=t.query_create()
            t.fetch_first(1)

            while .not. t.fetch_eof()
            c.fetch_first()
            while .not. c.fetch_eof()
            c.enter_begin()
            c.actdate=v_Actdate
            c.sp01sol=v_ActSol
            c.acttype="Spring Appeal Letter"
            c.enter_end(.t.)
            c.fetch_next()
            end while
            t.fetch_next(1)
            end while

            idx.drop()
            ui_msg_box("Activities Log","Done",UI_INFORMATION_SYMBOL)
            end

            I have a button on a form that, when pressed, prompts the user for two variables using an Xdialog box, then runs the above script.

            When I tested the script, I get the error message "idx=t.query_create field does not exist." Would this be referring to the query.filter part? The field Solicit is a logical field and maybe I don't have the right language in for the filter?

            On a more general note, was this what you were talking about?

            Comment

            Working...
            X