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

Adding Child Record to Web Application

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

  • Adding Child Record to Web Application

    Ver 9 Build 2095 sys addin build 3264

    * Ok I've worked through all the tutorials by Mr Workings and now I would like to know if it is possible to have a user create child records off and existing grid. Example, have a user on a Grid_1, where security is set allowing him to see only the record he is on equal to his userID to add a records to a Grid_2 linking it to the parent by stamping it also with his userID? If there is a tutorial already out there or someone can give me the correct keywords to search it here on this message board I'll hunt it down. thanks!!!!
    bob.corwin@gmail.com
    Los Angeles, CA
    cell/home 323-663-4735

  • #2
    Re: Adding Child Record to Web Application

    At this point in my tutelage, I'd be happy just to be able to create a child record and populate it with a field from the parent. Below is I hope a better explanation of what I'm trying to do in this web appliation.

    Grid 1 (table source 1)
    userID = 000001 (auto incremented)
    field 1
    field 2

    add child to Grid 2 (table source 2)
    userID = 000001 (stamped from Grid 1 upon record creation)
    field 3
    field 4
    (thanking anyone in advance for your help)
    bob.corwin@gmail.com
    Los Angeles, CA
    cell/home 323-663-4735

    Comment


    • #3
      Re: Adding Child Record to Web Application

      Mr Moderator... am I in the wrong forum? Or... Am I so far off the radar here no one knows how to respond? ( Also...I didn't realize it but an account I set up earlier that thought had been deleted is still there.. how does one delete an account on this board?
      bob.corwin@gmail.com
      Los Angeles, CA
      cell/home 323-663-4735

      Comment


      • #4
        Re: Adding Child Record to Web Application

        We are all moderators, there is no one specific that responds to questions about coding or the forum itself.

        Your question is harder than it may appear because pretty much any of us would have to actually test it out on a grid to see what happens. On the surface I can guess it is not possible on a grid because there is no event that takes place after the record is saved, and a "View" will not automatically create a child record.

        You would need an Event that fired after the record was saved because your ID is autoincrement, meaning it the value is created when the record is saved. And by then, the Grid is just sitting their showing the record you just saved.

        There are a couple ways you can accomplish this. In the grid Update Settings you can set the Target. This is the A5W page that the user will go to when they save a record. You could write code on that page that created your child records. The problem still exists that the page will not know which ID is the one you want to use to create the child records.

        So, in order to 'know' the ID before the records is saved, abandon using an autoincrement. Instead make your ID field 32 characters and use BeforeValidateNewRecords even to populate that field with a unique id that you create right in the event. You can use remspecial(api_uuidcreate()) to create the unique ID. Because you know what the ID will be BEFORE the record is saved, you can now add code to that same event that creates your entire child record using normal xbasic.

        But I don't tend to use a Grid for any of this, I use a dialog to add records and do complex processing. A grid is easier for just saving, updating and deleting records. You can get fancy in the Events, but it can become difficult.
        Steve Wood
        Join the ALPHA DEVELOPERS NETWORK
        There is no Cloud. It's just someone else's computer.
        Web - Mobile - Hosting - Products - Frameworks - Developer Resources
        AlphaToGo | IADN (100% Alpha Anywhere Websites)

        Comment


        • #5
          Re: Adding Child Record to Web Application

          whewww...thanks Steve!!! I've been holding my breath for a long time, thank you very much for the input.. Actually I only want to pass the value of the userID into the child record with an identical field called userID. Here it will function as a key-field linking my two tables. So really 'all' I need to learn how to do is stick a button on my page that fetches the value of the userID from one table/grid a stick it onto a newly created record in another table/grid with the same name. The user ideally would then continue on viewing the new page and continue entering new data onto the child record. In this app he would be jumping from a table containing general name/address info and entering a job description, date, time in, time out, etc. Over time there will be many child records for this user...

          The reason for the userID field in this scenario is that my security is set up so that when they log in they only see their own set of data.
          bob.corwin@gmail.com
          Los Angeles, CA
          cell/home 323-663-4735

          Comment


          • #6
            Re: Adding Child Record to Web Application

            If by UserID you mean something that identifies the logged in user, then you probably don't need to 'fetch' the value, you already have the value sitting in a session variable. If you are filtering your records to show only records that contain this UserID, you must already have it in a session variable based on them logging in. This can be their actual username from login, or their "ULINK" from security, however you happen to be filtering the record.
            Steve Wood
            Join the ALPHA DEVELOPERS NETWORK
            There is no Cloud. It's just someone else's computer.
            Web - Mobile - Hosting - Products - Frameworks - Developer Resources
            AlphaToGo | IADN (100% Alpha Anywhere Websites)

            Comment


            • #7
              Re: Adding Child Record to Web Application

              Let me ask this another way, how does one link a child record to the parent record at the time of creation? When John Doe comes back to look up his work history what is to prevent him from viewing all the work records in the grid and not just his own? My idea was that by passing on the userID value to the new record grid_2 it would be there acting as a filter the next time he logged on to view those records....(I'm struggling here hope I'm making sense)
              bob.corwin@gmail.com
              Los Angeles, CA
              cell/home 323-663-4735

              Comment


              • #8
                Re: Adding Child Record to Web Application

                Every grid is independent. When you open a grid, it is either filtered by the query you set in the grid or its not filtered. Grid "2" does not show or hide records because of any filter set in Grid "1", or any related value. You would filter your Grid 2 the same way as you did for your Grid 1.
                Steve Wood
                Join the ALPHA DEVELOPERS NETWORK
                There is no Cloud. It's just someone else's computer.
                Web - Mobile - Hosting - Products - Frameworks - Developer Resources
                AlphaToGo | IADN (100% Alpha Anywhere Websites)

                Comment


                • #9
                  Re: Adding Child Record to Web Application

                  Ok... if Grid-1 is filtered by a field called userID and Grid-2 doesn't contain that exact field name and value I can't filter on it???? So, maybe I'm asking the wrong question or what I'm asking cannot be done in Alpha for the Web.

                  How does one create a function that will carry that value, in this case a fields called userID from one grid to another automatically. The end result is I'm trying to set up a 'keyfield' relationship between two records...

                  (Steve...thanks for hanging in their with me)
                  bob.corwin@gmail.com
                  Los Angeles, CA
                  cell/home 323-663-4735

                  Comment


                  • #10
                    Re: Adding Child Record to Web Application

                    Steve
                    Maybe you should do one of your commercial extensions for this, could save newbies like me lots of work and give a flying start.
                    Cheers
                    John

                    Comment


                    • #11
                      Re: Adding Child Record to Web Application

                      yeah...who's got the 'secret sauce?' Where is the tidy little screen capture video showing you step by step how to link two tables in a web app? Anyone?
                      bob.corwin@gmail.com
                      Los Angeles, CA
                      cell/home 323-663-4735

                      Comment


                      • #12
                        Re: Adding Child Record to Web Application

                        This explaiins how you can see view the links table information but does not explain how you get the info in there in the first place.

                        These may help
                        http://support.alphasoftware.com/alp...View_Query.htm

                        http://msgboard.alphasoftware.com/al...ad.php?t=81887

                        http://msgboard.alphasoftware.com/al...ghlight=mapped
                        Cheers
                        John

                        Comment


                        • #13
                          Re: Adding Child Record to Web Application

                          Thanks John! Didn't give me the immediate answer but pointed out the need to go back to the basics and study them a litte further...
                          bob.corwin@gmail.com
                          Los Angeles, CA
                          cell/home 323-663-4735

                          Comment


                          • #14
                            Re: Adding Child Record to Web Application

                            I've re-read and think I can explain how to do what you want.

                            The following works IF the initial grid record already exists, and the autoincrement value has been set, and they are viewing this record in the grid. Click Calculated Fields under the Query section of the Grid. Make a field such as Mylink="Create Child", just like that but put what you want the link to say inside the double quotes.

                            Add this field to your grid and make it a LINK field type. Make the link value Computed from fields in the Grid.

                            You can use the builder or just type in createchild.a5w?userid={userID}

                            Save the grid, you are done here.

                            Create a new A5W page named createchild.a5w and go to Source. Completely erase all text in Source and then add your xbasic to create the child record(s). It might look like this:

                            Code:
                            <%a5
                            
                            dim tbl as p
                            tbl = table.open("mytable")
                            tbl.enter_begin()
                            tbl.userid=userid ' which you have in the URL as a page variable
                            tbl.field1 = "ABC" ' etc.
                            tbl.enter_end()
                            tbl.close()
                            response.redirect("childgrid.a5w")
                            
                            %>
                            Now create the grid that will display the child records and filter it the same way you did for the first grid. Place this grid on the childgrid.a5w page.

                            When the user clicks the link in the first grid, it will run through the xbasic in the createchild.a5w and then redirect them to the page that shows the child records.
                            Steve Wood
                            Join the ALPHA DEVELOPERS NETWORK
                            There is no Cloud. It's just someone else's computer.
                            Web - Mobile - Hosting - Products - Frameworks - Developer Resources
                            AlphaToGo | IADN (100% Alpha Anywhere Websites)

                            Comment


                            • #15
                              Re: Adding Child Record to Web Application

                              Big Thanks!!! Hope I'm clever enough to follow your detailed instructions Mr. Wood.... I'm gonna owe you heavily
                              bob.corwin@gmail.com
                              Los Angeles, CA
                              cell/home 323-663-4735

                              Comment

                              Working...
                              X