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

Delete Record Button - Error Message

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

    Delete Record Button - Error Message

    I have created a dialog that I am using to edit records in a grid. I successfully added a submit button to the dialog that will save the record. I tried adding a delete button but when I click on the delete button, I recieve a message that says " Error - You have not loaded primary keys for the Dialog. Therefore, you cannot delete this record"

    The delete button event is {dialog.object}.deleteRecord();

    Any help would be appreciated.

    Matt

    #2
    Re: Delete Record Button - Error Message

    Any ideas? My key fields are on the form. Is it not possible to delete a record from a dialog?

    Matt
    Last edited by bavism; 12-10-2012, 10:12 AM. Reason: typo

    Comment


      #3
      Re: Delete Record Button - Error Message

      Check your dialog's datasource definition and make sure that you have defined the primary key(s).

      Comment


        #4
        Re: Delete Record Button - Error Message

        Originally posted by agillbb View Post
        Check your dialog's datasource definition and make sure that you have defined the primary key(s).
        It is showing the correct column as a key. I am new to Alpha so to make sure I am checking this correctly, I went to Data Binding and chose "Specify Primary Keys and Sequences". In Table Properties the primary key field(s) is set to the correct column.

        Comment


          #5
          Re: Delete Record Button - Error Message

          Hi,
          Did you find what was the problem?
          I am having the same issue when trying to navigate a record (Next or previous).

          Thanks

          Comment


            #6
            Re: Delete Record Button - Error Message

            I wasn't really looking for this but I think this might hold the answer to your problem.

            http://http://msgboard.alphasoftware...ht=primary+key

            Comment


              #7
              Re: Delete Record Button - Error Message

              Thank you very much. This is exactly the solution.

              Paul

              Comment


                #8
                Re: Delete Record Button - Error Message

                I have exactly the same problem. Grid with row expander (Dialog2) used to update/delete record. Update works, but delete button says: " Error - You have not loaded primary keys for the Dialog. Therefore, you cannot delete this record".
                I would like to add that in my onDialogInitialize event, I do not have the action script option for loading keys from parent table... only populate
                Rapid Development, Training, Support
                http://data2web.network
                903-740-2549

                Comment


                  #9
                  Re: Delete Record Button - Error Message

                  Add this in the on dialog initialize
                  ExecuteServerSideAction("Get Primary Keys for Parent Table::Load_Primary_keys_for_Parent_Table")
                  You should have it in the action script search for it...

                  Comment


                    #10
                    Re: Delete Record Button - Error Message

                    That command is missing from my action script choices... see image below. What am I supposed to do now?
                    When I paste the above command anyway and try to edit it, I get Action Not Found.
                    actionscripts.gif
                    Rapid Development, Training, Support
                    http://data2web.network
                    903-740-2549

                    Comment


                      #11
                      Re: Delete Record Button - Error Message

                      I had nothing but problems with this as well. I added the action scripting, I rearanged the action scripting, I updated my table scheme in the bindings and so on. In the end I just wrote a deleteRecord xbasic function in my dialog. WAY easier than trying to get this built in fuction to work.

                      I'm actually deleting from multiple bound tables. Here's version 1.0 of my code if it helps:
                      Code:
                      function deleteCurrentRecord as c (e as p)
                      	dim recid as n
                      	recid = e.dataSubmitted.UNIQUE_ID
                      	'debug(1)	
                      	dim vjsdel as c
                      	dim con as SQL::Connection
                      		if con.open("::Name::MVWKS")	then
                      			dim sqlDeleteCmd as c = "DELETE FROM machlayoutdetail WHERE layoutmaster_id = :recid"
                      			dim args as SQL::Arguments
                      			args.add("recid",recid)
                      				'Delete Detail Record
                      				con.Execute(sqlDeleteCmd,args)
                      				vjsdel = js_escape(con.callResult.text) + js_escape(con.CallResult.RowsAffected) + ": Rows Deleted From Detail\n"
                      					sqlDeleteCmd = "DELETE FROM machlayoutsubprograms WHERE layoutmaster_id = :recid"
                      					'Delete Sub Programs Record
                      					con.Execute(sqlDeleteCmd,args)
                      					vjsdel = vjsdel + js_escape(con.callResult.text) + js_escape(con.CallResult.RowsAffected) + " : Rows Deleted From Subs\n"
                      						sqlDeleteCmd = "DELETE FROM machlayoutmaster WHERE unique_id = :recid"
                      						'Delete Master Record
                      						con.Execute(sqlDeleteCmd,args)
                      						vjsdel = vjsdel + js_escape(con.callResult.text) + js_escape(con.CallResult.RowsAffected) + ": Rows Deleted From Master\n"
                      		else
                      			vjsdel = "alert('Connection Error: Error returned was: " + js_escape(con.CallResult.text) + "');"
                      		end if
                      	vjsdel = 	"{Dialog.Object}.newRecord();setTimeout(function(){alert('"+vjsdel+"')},500);"
                      	'debug(2)		
                      deleteCurrentRecord = vjsdel
                      end function
                      If you've only got one table to worry about you can get rid of half of the above.

                      Comment


                        #12
                        Re: Delete Record Button - Error Message

                        Hi AH,
                        One question, what parameter are passing to this function when you are calling it? deleteCurrentRecord(xxxx?)
                        Edhy Rijo
                        Progytech
                        (Computer Consultants)
                        The makers of CardTracking.Net
                        www.progytech.com

                        Comment


                          #13
                          Re: Delete Record Button - Error Message

                          I'm not passing any parameters into the function during the onclick event for the ajax callback. I am getting the unique_id of the record from the e.dataSubmitted object during the actual function itself.
                          Code:
                          recid = e.dataSubmitted.UNIQUE_ID
                          That's how it knows which record to delete (the current one) and all of my tables have the unique id from the header in them.

                          To tell you the truth I don't really know what (e as p) means. I just followed an example for making a function and coded it to my use.

                          Maybe it sets the type of the "e" object? I'd like to know for future reference.
                          Last edited by -Jinx-; 01-16-2013, 07:18 PM.

                          Comment


                            #14
                            Re: Delete Record Button - Error Message

                            Hi Jinx,
                            Thanks for the clarification, so this is handle by the A5 callback. The (e as P) is a Pointer variable that can have many properties each with its own value like this:
                            Code:
                            dim colors as p
                            colors.Blue = 1
                            colors.White =2
                            colors.Red = 3
                            Edhy Rijo
                            Progytech
                            (Computer Consultants)
                            The makers of CardTracking.Net
                            www.progytech.com

                            Comment


                              #15
                              Re: Delete Record Button - Error Message

                              I don't use the built-in delete function either. Before this function was even available I coded my own generic xBasic function that took parameters like:
                              - tablename (e.g. "Customers")
                              - whereclause (e.g. "CustomerID = 234")
                              - returntype (e.g. "ALERT" which tells the function what javascript should be used to indicate success or failure)

                              You get the idea....

                              Comment

                              Working...
                              X