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

Add a child record for a repeating section record

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

    Add a child record for a repeating section record

    I have a UX with a repeating section, and I want to add a child record for the selected record in the repeating section. I have a button on each row of the repeating section, when I click it I want to open another UX to enter further data, if warranted. Not all of the repeating section records will require additional data, so I created another table(MySQL) to hold the additional fields, two of them are long text fields, so I would rather not include them in the table holding the repeating section records. The MySQL table is set up correctly, but I cannot figure out how to get the primary field of the repeating section record into the UX when it is opened.

    #2
    Re: Add a child record for a repeating section record

    There's probably a better way of doing this... but...

    In your parent UX, in the Repeating Section, on the Edit button, use the Action Javascript Open a UX component. In this action use the Populate UX component with data from a table option... filling in all the required stuff.

    Now you've got your "Edit" Child UX opening with the data from your repeating section. Your Child UX you've already built... and it's data bound... and don't put anything into the server-side onDialogInitalize event. But you do need the afterDialogValidate event. In this event you'll need your server side action to save your data. In this action you can also specify a javascript function to run after the save is complete. In this Client side After save event put... refreshParent.



    Next, in your Child UX Javascript functions put this...

    Code:
    function refreshParent(){
    
    var pObj = {dialog.Object}.getParentObject();
    if (pObj){
    	var currkey = pObj.getKey('tblcustomers');
    	pObj.populateControlsFromTable(currkey);
    	}
    
    }
    This code grabs the parent UX, gets the current key of the UX (you'll need to put your Alias table name in), and then it re-populates the UX with the current data.

    I do wonder if this is too much effort though... too complicated.

    One drawback is that you lose the current row you were on in the repeating section. You could fix this by grabbing the current row in the first place... and then resetting the RS to that row.

    Comment


      #3
      Re: Add a child record for a repeating section record

      but I cannot figure out how to get the primary field of the repeating section record into the UX when it is opened.
      there won't be any, if what i think is correct.
      in an ux, the data is not saved until the data is submitted to the database and the primary key for the header and the repeating sections are derived via the lastInsertedId by the connection. hence when another ux is opened thru a button in the unsaved repeating section, there will be no key for the record in the repeating section yet.
      i think there may be another way to do what you are looking to do. that is to open the ux for the grandchild and save the data and get that key and make that key part of the repeating section data so you are only adding an integer to the child table not long text, if that is primary concern. so every record will have that integer if there is any or nothing.
      this scenario is like having a memo field in a separate table and only keep the linking key in the table to which the data would have belonged.
      or a second approach, save the data in the parent, child ux and keep the newly entered data available then click the button to add the specific notes to the grandchild table, then the parent record id (in this case the child record id from the repeating section) will be available.
      third approach will be to do it in a grid.
      parent grid presented as a single form, save it then the repeating child table is presented single line at a time automatically saved, then when you add the grandchild via ux opened thru a button the primary key for the child record will be available. there won't be a need to save the grandchild record id in the child table.
      hope this is correct.
      Last edited by GGandhi; 12-31-2014, 07:50 AM.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #4
        Re: Add a child record for a repeating section record

        Thank you for responding Gandhi. I may have done a poor job trying to explain what I need. I did as you suggested, but it does not work. When the UX is opened from the repeating section, it says "Record Not Found". Of course it will not be found because it does not exist. (see attachments)

        The repeating section is based on a MySQL table called "Audits" and the child UX is based on a table called "Audits_descr". They are set up correctly with primary field and foreign field.
        In the image, you can see the button and the primary field for the repeating section record. The child UX has the foreign ID on the bottom of the UX. I need the UX to open up to insert a new record in the child table.


        1.jpg

        2.jpg

        Comment


          #5
          Re: Add a child record for a repeating section record

          I
          did as you suggested, but it does not work
          which method you followed, I suggested 3 ways of doing it. by looking at the image, looks like the second one.
          when you open the grandchild ux you should be able to copy the id that is available in the child ux as shown in audit_id, by proper linking.\
          I won't have time today, since it is the biggest day for us.
          I could try tomorrow if you have not solved by then
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: Add a child record for a repeating section record

            Thank you Gandhi, I will keep trying and let you know. Hope you have a Happy New Year.

            Comment


              #7
              Re: Add a child record for a repeating section record

              Sorry... I mis-read your post.

              You need to add a new RS record, and then open your Additional Info UX. That UX needs a Key from the RS which doesn't exist... yet. But it can.

              On your RS button add a new action... and this needs to be your first action. The action will be Inline-Javascript found in the Ajax Callbacks and Javascript section.

              This Inline-Javascript will be...

              Code:
              {dialog.Object}.submit();
              This will save your new RS record.

              Your 2nd action here will be to open your UX. Your child UX will have the appropriate Server-side onDialogInitialize event for getting the primary keys... and the afterDialogValidate for saving the data.

              This 2nd action will NOT use the Populate a UX Component with Data from a Table.

              Make sure you check the "Run actions synchronously" checkbox at the bottom of the Actions dialog.

              In your Child UX... in the Client-side onRenderComplete event put this...

              Code:
              {dialog.object}.newRecord();
              var pObj = {dialog.Object}.getParentObject();
              if (pObj){
              	var currKey = pObj.getValue('SYSTEMID');
              	setTimeout(function(){
              		{dialog.Object}.setValue('SYSTEMID',currKey);
              	},500);
              }
              Here, when the UX renders, we'll add a new record.

              Then we'll go and get the newly created key from the parent UX RS (in my case SYSTEMID).

              Then we're going to put that value into the Child UX Textbox control. But... we have to give newRecord() a bit of time to complete... so we wrap the setValue in a setTimeout. I set it at 500, but you can test with less time.

              Comment


                #8
                Re: Add a child record for a repeating section record

                while you are trying test this,
                on the button that opens the ux define 2 functiins
                1 - inline javascript that takes the value of the audit_id and puts that into a window object, name it anyway you want.
                2 - open the ux and look for the window object and assign that to the id in the grandchild record.
                I showed in a grid recently not too long ago. I will look for that post and post you the link
                thanks for reading

                gandhi

                version 11 3381 - 4096
                mysql backend
                http://www.alphawebprogramming.blogspot.com
                [email protected]
                Skype:[email protected]
                1 914 924 5171

                Comment


                  #9
                  Re: Add a child record for a repeating section record

                  That worked great David. Thank you very much.

                  Comment


                    #10
                    Re: Add a child record for a repeating section record

                    after a very busy night, got up and just saw that you have solved your issue, I am glad to see that.
                    but the solution seems to add notes for all the records. is that correct? I am under the impression that there will be notes in few lines but not all the lines.
                    Not all of the repeating section records will require additional data
                    did this solution address that situation, too.
                    I am just curious.
                    Last edited by GGandhi; 01-01-2015, 11:10 AM.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: Add a child record for a repeating section record

                      That is correct Gandhi, only a small portion of the records will require additional information in the other table. The solution does not add another record unless the button is clicked and the UX is opened for additional information. Seems to be working good so far. The only thing I am trying to work out now is: when the UX opens I want it to show the record, IF one has already been entered and if not, then open it in new record mode.
                      Thank you for following up Gandhi.

                      Comment

                      Working...
                      X