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

Set the Value of a Field on the Detail view from the Grid data

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

    Set the Value of a Field on the Detail view from the Grid data

    This is probably easy for most out there... I'm new... but I can't find the answer anywhere easily. (Actually, I find it hard to find the answers to anything with Alpha 5 v10 web development :-(...

    Anyway, all I want to do is this... I have a Grid componet that is based off of a query of two tables. It is a one-to-many relationship. When the main grid is clicked and the detail shows... and then a new record is added... I want to set the value of a field in the detail on a new record to the value of a field in the current grid (ie Facility Id in grid should pass to the Facility ID in a new record on the other table (detail table ... on the 'many' side of the relationship). In access you would use SetValue. What is the easy way to do this in Alpha 5 v10, web development?

    #2
    Re: Set the Value of a Field on the Detail view from the Grid data

    i believe if you link the two grids together using linked content in the properties of the parent grid, then the id from the parent should autmatically be etered in to the child grid for you.

    Comment


      #3
      Re: Set the Value of a Field on the Detail view from the Grid data

      The answer is correct for the ID, but it doesn't answer the more general case.

      Where exactly does the parent ID get entered into the child grid?

      Can someone answer this question for filling in the field in the detail from something in the grid other than the ID of the parent?

      I have a nesting of grids for tables of Project -> Group -> Item and on entering a new Item record with detail view in Item, I'd like to get the ID not just of the selected Group to fill in a field of Item (which works), but also put selected Project ID in a field in the new Item.

      Thanks much!

      Comment


        #4
        Re: Set the Value of a Field on the Detail view from the Grid data

        Not exactly clear on what you are asking. But since you can link a child grid on multiple fields, I assume they all update in the child when you add a new child record. Haven't tried this myself for multi-field links. BTW: Not sure how the detail view comes into play here?
        Peter
        AlphaBase Solutions, LLC

        [email protected]
        https://www.alphabasesolutions.com


        Comment


          #5
          Re: Set the Value of a Field on the Detail view from the Grid data

          This is very easy.

          As the subsequent messages in this thread point out, the LINKING fields are automatically filled in.

          However, if you want to set the non-linking fields in the Detail View to values that are taken from the current row in the parent Grid you can put code in the AfterDetailViewNewRecord client-side event.

          Code:
          //get a pointer to the parent Grid object
          var po = {grid.Object}.getParentObject();
          if(po) {
          	//get the current row number in the parent grid
          	var parentRowNumber = po._selectedRow;
          	//read some data from the parent grid - in this case, the 'lastname' field
          	var data = po.getValue('G','LASTNAME',parentRowNumber);
          	//fill in the lastname field in the Detail View with the value in the data variable
          	{grid.object}.setValue('D','LASTNAME',data);
          }

          Comment


            #6
            Re: Set the Value of a Field on the Detail view from the Grid data

            This brings up an issue I have experienced and thought it might be a good time to get some thoughts. Sorry if I'm hijacking this thread.

            I have a grid that uses this exact method and it works great except for one detail. In my grid the detail view is shown in a popup window and has a "new" button at the bottom of the child grid for adding new records to the child.

            Here's the problem; after expanding the linked content of any row, but before selecting the "new" button in the child grid, select another record in the parent grid, and then click "new" in the child grid. The values filled in are now from the "selected" row, not the parent of this particular child. This leaves it open to fill in the values from any parent into the new record but the ID's are filled in for the "actual" parent. Maybe that is by design (using po._selectedRow;), but I'm wondering if there is a way to ensure that the parent row is always selected when the "new" button is clicked or is there another way to point to the parent, not the selected row.
            - Dan Hooley
            - Custom Desktop or Web database development -

            Comment


              #7
              Re: Set the Value of a Field on the Detail view from the Grid data

              I don't really understand the point that you are trying to make.

              It sounds to me like you are saying that if you click on a different parent record, then click on the 'Add new record' link in the Child grid, the values that are entered into the fields in the Child grid's Detail View are from the wrong parent record.

              If that is indeed what you are saying, then I cannot duplicate this. It does NOT exhibit this behavior for me.

              I have attached a video that shows my test case:

              http://screencast.com/t/1HoOlJsBUK

              Comment


                #8
                Re: Set the Value of a Field on the Detail view from the Grid data

                Yes, that is exactly what I am saying. My child grid is in a row expander, so one row can be expanded and then without collapsing that one, another parent can be selected. So you have the child grid showing for one parent, but a different parent selected. I did a short jing to show what I am talking about.

                Here is my example:
                http://www.screencast.com/t/19gQXwlH
                - Dan Hooley
                - Custom Desktop or Web database development -

                Comment


                  #9
                  Re: Set the Value of a Field on the Detail view from the Grid data

                  Dan,

                  I heard Selwyn's example loud and clear but cannot hear yours even with the volume turned up all the way.
                  TYVM :) kenn

                  Knowing what you can achieve will not become reality until you imagine and explore.

                  Comment


                    #10
                    Re: Set the Value of a Field on the Detail view from the Grid data

                    I watched your video and I see that it is perhaps not doing what you WANT, however, it is doing what it is SUPPOSED to be doing.



                    It is reading data from the 'selected' row and the selected parent row is indicated by the icon. It is working correctly.

                    You will need to come up with another technique to solve your problem. However, there are all of the necessary client side events to make this easy.

                    Without actually writing the code for you, the approach that I would take:

                    In the onGridInitializeComplete event of the child grid, I would add code like this:


                    Code:
                    var po = {grid.Object}.getParentObject()
                    var row = po._selectedRow;
                    var data = po.getValue('G','LASTNAME',row);
                    {grid.object}._mydata = data;
                    In this case, I am storing the value of the parent Grid's 'lastname' field into the Grid Object for the child grid that was opened in the row expander.

                    Then in the afterDetailViewNew record, i would read the value that I had stuffed into the Grid Object when the child grid was initially displayed.
                    For example:

                    Code:
                    var po = {grid.Object}.getParentObject();
                    if(po) {
                    	//get the current row number in the parent grid
                    	data = {grid.object}._mydata 
                    	//fill in the lastname field in the Detail View with the value in the data variable
                    	{grid.object}.setValue('D','PAY_METHOD',data);
                    }

                    Comment


                      #11
                      Re: Set the Value of a Field on the Detail view from the Grid data

                      Thanks Sewlyn for pointing me in the right direction. I thought it might be something like that, but didn't know where to begin. Thanks again.
                      - Dan Hooley
                      - Custom Desktop or Web database development -

                      Comment

                      Working...
                      X