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

Xbasic INSERT from embedded grid to another SQL table

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

    Xbasic INSERT from embedded grid to another SQL table

    I have a UX with an embedded grid. From within this UX I want specific rows of data from the embedded grid to INSERT into another SQL table. I know how to write an xbasic function to insert when the fields being inserted are on the UX itself but I'm unsure how the function would look like when it's an embedded grid I am getting the data from.
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    #2
    Re: xBasic INSERT from embedded grid to another SQL table

    This isn't really an answer to your question but I do something similar with a list component and it works very well for me. It involves inserting values from the list component into a repeating section on my dialog. That way, the user can check it over first before submitting it and saving it to the table. If this would be an option for you, I could help you out with that. No Xbasic, just javascript.

    If you still want to do it with the grid, I think there is a video on embedded grids and the parent/child objects that might help out.

    Comment


      #3
      Re: xBasic INSERT from embedded grid to another SQL table

      Originally posted by -Jinx- View Post
      This isn't really an answer to your question but I do something similar with a list component and it works very well for me. It involves inserting values from the list component into a repeating section on my dialog. That way, the user can check it over first before submitting it and saving it to the table. If this would be an option for you, I could help you out with that. No Xbasic, just javascript.

      If you still want to do it with the grid, I think there is a video on embedded grids and the parent/child objects that might help out.
      I'd be interested. I could setup a repeating section (as opposed to a grid) for my purposes. Would you mind sharing you JS code? ...although you use a list I may be able to adapt it for my needs.
      Mike Brown - Contact Me
      Programmatic Technologies, LLC
      Programmatic-Technologies.com
      Independent Developer & Consultant​​

      Comment


        #4
        Re: xBasic INSERT from embedded grid to another SQL table

        Mike, this is what I'm doing. I think it may be similar to what you'd like. If it is, I'll share my code.

        http://screencast.com/t/9eQGDz99CR

        Comment


          #5
          Re: xBasic INSERT from embedded grid to another SQL table

          Thanks Jinx. I'm not sure this will work for my needs after all.

          I looked through some of Alpha's videos but I haven't come across anything that is helpful for my purposes.
          Mike Brown - Contact Me
          Programmatic Technologies, LLC
          Programmatic-Technologies.com
          Independent Developer & Consultant​​

          Comment


            #6
            Re: xBasic INSERT from embedded grid to another SQL table

            I figured out how to get at the grid values with javascript. I'm still not certain how to get them in Xbasic though. For javascript, something like this will work to get a value in a grid:

            Code:
            //get a pointer to your embedded grid
            var embgrd = {dialog.Object}.getChildObject('YOURGRIDALIAS','grid');
            //get current selected row number in the embedded grid
            var rn = embgrd.getSelectedRow();
            //Use the grid getValue method but replace the beginning placeholder with your new one
            var grdfld1 = embgrd.getValue('G','YOURGRIDFIELDNAME',rn);
            //test alert
            alert(grdfld1);
            You could loop through that stuff and get what you want to send back in an ajax callback. Or you could hide some fields on your UX and send the values to them to get into your ajax callback.

            There's probably a better way to do it, but this would probably work.
            Last edited by -Jinx-; 04-23-2014, 04:07 PM.

            Comment


              #7
              Re: xBasic INSERT from embedded grid to another SQL table

              Hi Jinx,
              Can you please post this sample?

              Comment


                #8
                Re: xBasic INSERT from embedded grid to another SQL table

                Hi amitloh,
                I haven't really looked it over (or checked to see if there is a better way to do it) in a long time. But here is the JavaScript from that video:

                Code:
                //Get the selections from the list. An array is returned
                
                var lstsel = {dialog.Object}.getValue('P2DLIST');
                //work around for /n instead of comma seperators
                //var lstsel = {dialog.Object}.getValue('P2DLSTDAT');
                //alert(lstsel);
                
                if (lstsel != '') {
                
                //work around for /n instead of comma seperators need to convert to array now. not needed if first var lstsel is working
                //lstsel = lstsel.split(',');
                
                //Get Value From DwgNo Field
                var DwgNo = {dialog.Object}.getValue('DWGNO');
                
                //Get the values out of all the partno controls in the repeating section
                var RsPnVl = {dialog.Object}.harvestRepeatingSectionColumn('PARTNO');
                //Convert to an array
                var RsPnVl = RsPnVl.split(',');
                //alert(RsPnVl[0]);
                
                //Get the count of the current rows in the reapeating section
                var RsRwCnt = {dialog.Object}._getRepeatingSectionRowCount('CONTAINER_1');
                //alert(RsRwCnt);
                
                //Compare the repeating section array and the list selection array to remove the duplicates
                var NwVal = lstsel.filter(function(val) {
                  return RsPnVl.indexOf(val) == -1;
                });
                
                
                //alert(NwVal);
                //alert(lstsel[0]+' '+lstsel.length);
                
                //Add new repeating rows and set the values
                
                for (i=0;i<NwVal.length;i++)
                {
                RsRwCnt = RsRwCnt +1
                {dialog.Object}.addRepeatingSectionRow('CONTAINER_1');
                //{dialog.object}.setValue('PARTNO:'+RsRwCnt+'',NwVal[i]);
                //{dialog.object}.setValue('DWGNO:'+RsRwCnt+'',DwgNo);
                {dialog.object}.setValue('PARTNO:',NwVal[i]);
                {dialog.object}.setValue('DWGNO:',DwgNo);
                
                //alert(RsRwCnt+' '+NwVal[i]+'\n'+RsRwCnt+' '+DwgNo);
                }
                }
                
                var lObj = {dialog.object}.getControl('P2DLIST');
                lObj._deselectAll();
                You can see all the commented out stuff. That was a work-around that I had to develop for a bug.

                Comment


                  #9
                  Re: xBasic INSERT from embedded grid to another SQL table

                  can we use https://www.youtube.com/watch?v=yhcXka5dM2s (multi select listcheckbox) and transfer the selected rows to grid(editable-only price/quantity)

                  Comment


                    #10
                    Re: xBasic INSERT from embedded grid to another SQL table

                    Yes, at least you can transfer them to a repeating section, which is what I'm doing above. the lstsel variable is actually the list selections. You dont' need to do the other stuff I'm doing in there except for then transferring the info to the repeating section (near the bottom) Then, you can have another field in the repeating section where you can edit price/quantity.

                    Amit, you are going to have to watch a lot of videos and read a lot on this forum before you get proficient with this. Unfortunately I don't have time to take you through this step by step. Of course, given that I have time, I have no problem helping out, especially with specific questions.

                    You can also buy support or pay a mentor to help you out if you get REALLY stuck.

                    Comment


                      #11
                      Re: xBasic INSERT from embedded grid to another SQL table

                      thanks!

                      Comment


                        #12
                        Re: xBasic INSERT from embedded grid to another SQL table

                        Hi Jinx,

                        I was able to get repeating section working with your video and help!
                        Now
                        https://www.alphasoftware.com/alphaf...-doing-editing

                        When clicked on above grid I need same form but in edit mode. I am able to insert records but now after redirect it goes to landing grid and after redirect with query string as orderID I do not get edited part on same page.query1.pngnext.pngclick.pngquery.png

                        http://sp2013srv:1580/Orderdetails.a5w?orderID=23

                        I need to know how to use query string in above to get existing data.

                        Comment


                          #13
                          Re: xBasic INSERT from embedded grid to another SQL table

                          Hi Jinx,

                          I figured all out!
                          Alpha is great with help and articles and support!!

                          Comment

                          Working...
                          X