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

How do I save the data from an Unbound Grid

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

    #31
    Re: How do I save the data from an Unbound Grid

    may be, it is time to post your code here.
    so i or any one can help you.
    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


      #32
      Re: How do I save the data from an Unbound Grid

      Gandhi


      This is the code as setup an XBasic Function - The failure seems to be on the insert

      function addConsequence as c (e as p)

      dim person_id as n
      dim consequence as c

      person_id = e._currentRowDataNew.person_id
      consequence = e._currentRowDataNew.consequence

      'connect to database
      dim cn as sql::connection
      dim result as l
      result = cn.open("::Name::RSPortal")
      if result = .f. then
      addConsequence = "alert('Could not connect to database!');"
      exit function
      end if
      'check to see if the person_id exist if so update - do not insert new one
      sqlSelect = "SELECT * FROM rs.con_detail WHERE person_id = :newPERSONID"
      dim args as sql::arguments
      args.add("newPERSONID",person_id)
      result = cn.Execute(sqlSelect,args)
      if result = .t. then
      dim rs as sql::ResultSet
      dim flag as l
      rs = cn.ResultSet
      flag = rs.nextRow()
      if flag = .t. then
      dim sqlUpdate as c
      sqlUpdate = "UPDATE rs.con_detail SET consequence = :newCONSEQUENCE where person_id = :newPERSONID"
      dim args as sql::arguments
      args.add("newCONSEQUENCE",consequence)
      args.add("newPERSONID",person_id)
      result = cn.Execute(sqlUpdate,args)
      if result = .f. then
      addConsequence = "alert('Record could not be updated!');"
      cn.close()
      exit function
      end if
      addConsequence = "alert('The student data is updated');"
      exit function
      cn.close()
      end if

      else
      'since the data does not exist then add new record
      dim sqlInsert as c
      sqlInsert = "INSERT INTO rs.con_detail(person_id,consequence) VALUES(:newPERSONID,:newCONSEQUENCE)"
      dim args as sql::arguments
      args.add("newPERSONID",person_id)
      args.add("newCONSEQUENCE",consequence)

      result = cn.Execute(sqlInsert,args)
      if result = .f. then
      addConsequence = "alert('Record could not be inserted!');"
      cn.close()
      exit function
      end if
      addConsequence = "alert('Record successfully inserted!');"
      cn.Close()
      end if
      exit function
      end function

      Chris

      Comment


        #33
        Re: How do I save the data from an Unbound Grid

        i did not change the original script as far as insert is concerned, and the original inserted successfully.
        you can put debug(1) as second line just below the function declaration and test it on working preview it might shed some light.
        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


          #34
          Re: How do I save the data from an Unbound Grid

          mmmmm

          It is failing on this:-

          person_id = e._currentRowDataNew.person_id
          consequence = e._currentRowDataNew.consequence

          Which is a little odd because as you say that hasn't changed.

          Chris

          Comment


            #35
            Re: How do I save the data from an Unbound Grid

            Mine the e variable in your debugger. See what's in there.

            There may also be a certain option that you left unchecked in your ajax callback option that IIRC has to do with the "new" data submitted.

            Comment


              #36
              Re: How do I save the data from an Unbound Grid

              follow these steps ( i may be telling lot of things you know already, but i want to be on the same page as yours)
              on the button onClick event select ajax callback
              on the pop up window the last line compute current row data - check that.
              put debug(1) on the second line
              test it on the working preview.
              let us know
              (thanks to a h - i have added for you to check compute current row data)
              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


                #37
                Re: How do I save the data from an Unbound Grid

                The Debug shows up the following

                Variable "person_id" not found
                Variable "consequence" not found

                I try the same code in the OnClick and do not get the same eror.


                Chris

                Comment


                  #38
                  Re: How do I save the data from an Unbound Grid

                  I try the same code in the OnClick and do not get the same eror.
                  so you are getting this onChange event of the field. then go back to the ajax callback on that field and click the compute current data - the last line. and test it again.
                  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


                    #39
                    Re: How do I save the data from an Unbound Grid

                    Gandhi

                    That has been checked from the beginnign.

                    Chris

                    Comment


                      #40
                      Re: How do I save the data from an Unbound Grid

                      then you are better off leaving the button and onclick event which does not give errors.
                      you asked about submitting additonal data like p1,p2 and email etc they need to be harvested and added.
                      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


                        #41
                        Re: How do I save the data from an Unbound Grid

                        Gandhi

                        I have already added the email address, I just to need ti figure out how to match the time with the period and then I can check to see if that consequence has been given in the current lesson.

                        From that I should be able to use your code for update or insert on the onclick event.

                        Cheers Chris

                        Comment


                          #42
                          Re: How do I save the data from an Unbound Grid

                          you could check multiple fields, if that's what you are asking

                          sqlSelect = "SELECT * FROM rs.con_detail WHERE person_id = :newPERSONID AND something = :newSOMETHING"
                          and set the arguments there.
                          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


                            #43
                            Re: How do I save the data from an Unbound Grid

                            Amended Below
                            Last edited by Turnbullca; 03-12-2013, 09:04 AM.

                            Comment


                              #44
                              Re: How do I save the data from an Unbound Grid

                              Hi Gandhi

                              I am ok with the checking of the fields and updating of the record bit I am having trouble with the script below.

                              I click on the Consequences Radio Bution and I want the following code (Which is supposed work out the time of day and assign it a period base on that time) this would then populate the field called period.

                              I want to ask 2 qusetions - is this a long way round of doing this and is it actually correct.

                              Also when I run the Grid and this code is assigned I get an error on the Page that says Line 1 Char 43 Error Expected ":" - Any Ideas



                              Tidied the Code Up and it passes an Online JS Checker but still have the : Error

                              var rowNum = {Grid.RowNumber};
                              var vPeriod = '';
                              var currTime = new Date();
                              var hours = currTime.getHours();
                              var minutes = currTime.getMinutes();

                              if (hours==9){vPeriod='1';}

                              if (hours>=10){vPeriod='2';}

                              if (hours==11){
                              if(minutes<=20){vPeriod='2';}
                              }
                              if (hours==11){
                              if(minutes>20){vPeriod='3';}
                              }
                              if (hours==12){
                              if(minutes<=20){vPeriod='3';}
                              }
                              if (hours==12){
                              if(minutes>20){vPeriod='4';}
                              }
                              if (hours==13)
                              {
                              vPeriod = '4';
                              }
                              if (hours==14){
                              if(minutes<=5){vPeriod = '4';}
                              }
                              if (hours==14){
                              if(minutes>5){vPeriod = '5';}
                              }

                              {grid.Object}.setValue('G','period',rowNum,vPeriod);

                              Comment


                                #45
                                Re: How do I save the data from an Unbound Grid

                                One thing I see is:
                                {grid.Object}.setValue('G','period',rowNum,vPeriod); Needs to be {grid.Object}.setValue('G','PERIOD',rowNum,vPeriod);

                                Comment

                                Working...
                                X