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

Submit New - or Rather Saveas New

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

  • Submit New - or Rather Saveas New

    I have a typical UX with submit and reset buttons, what I would like to do is create a "SaveAsNew" button

    The idea being that I open a current record edit it and then "Save As New" meaning I save it as a new record.

    Can anyone give me some direction on accomplishing this?

    As always, thanks for your ideas!
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

  • #2
    Re: Submit New - or Rather Saveas New

    oh just to add a twist - there are two repeating sections as well. so this UX is editing 3 tables. One Parent table with 2 linking tables.
    Its an Invoice, with items in one table and payments in the other.
    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

    Comment


    • #3
      Re: Submit New - or Rather Saveas New

      I'm curious if someone has a better idea, but one thought that comes to mind is to delete the keys object before submitting.

      The UX keeps track of the existing record in an object of the UX: {dialog.Object}.stateInfo.keys

      I haven't tried this, but if your Save as New button would delete this object then submit, I bet it would save it as a new record.

      If you want to try it, do something like this in the onClick event of your Save as New button:
      delete {dialog.Object}.stateInfo.keys;
      {dialog.Object}.submit();

      If you have any of the record ID fields on the UX (both header and repeating sections), you need to clear those as well, so it doesn't generate a "duplicate ID" error.
      - Dan Hooley
      - Custom Desktop or Web database development -

      Comment


      • #4
        Re: Submit New - or Rather Saveas New

        Hi
        I had a similar case, what I did I duplicate the row and did the edit and save as a new record.
        Not sure if this what you want
        Do a search in the video finder search video: D33

        Comment


        • #5
          Re: Submit New - or Rather Saveas New

          Thanks for the input guys, I am still trying to find "the" solution, but this is interesting conversation for sure. Anyone with another idea on how to get it done?
          NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

          Comment


          • #6
            Re: Submit New - or Rather Saveas New

            You're probably asking for a world of hurt trying to find a shortcut for this. You have the keys to all your tables... fire off an Xbasic function which grabs the data from each table and performs an insert.

            Doing this safeguards your function from any changes the UX may go through.

            Comment


            • #7
              Re: Submit New - or Rather Saveas New

              David, I have no idea how to do that! I have learned so much in the last couple of years, but I have never seen an example (that I can relate) of this to even begin to know what to do. Ghandi, was on the verge of showing me some xbasic to grab the form data and fire off an email - but I went another route using reports. There is so much to learn! Between Twin Peaks, the Alpha videos, this forum and a couple of E-books you would think I would know this by now but there are only so many hours in the day and I am burning the candle at both ends!

              I wish Alpha would include a "Save as New" button in the UX offering under Defined Controls. It seems like an easy button to code if you knew what you were doing!
              NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

              Comment


              • #8
                Re: Submit New - or Rather Saveas New

                So -

                Curious.

                You can clone a record with {dialog.object}.newRecord():
                Code:
                //Create a new record that is a copy of the existing record, but do not copy the INVOICE_NUMBER and CUSTOMER_ID fields.
                {dialog.object}.newRecord({cloneExisting: true, fieldsToNotCopy: ['INVOICE_NUMBER','CUSTOMER_ID']});
                This doesn't save it immediately. But there are ways to add that.
                Alpha Anywhere latest pre-release

                Comment


                • #9
                  Re: Submit New - or Rather Saveas New

                  Learn something new everyday ...I have an entire xbasic routine that I use to duplicate records and now it appears I could have done the same thing with a few lines a JS code.
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant

                  Comment


                  • #10
                    Re: Submit New - or Rather Saveas New

                    One line, even...

                    Code:
                    {dialog.object}.newRecord({cloneExisting: true});
                    Alpha Anywhere latest pre-release

                    Comment


                    • #11
                      Re: Submit New - or Rather Saveas New

                      I am curious too, Charles.
                      Its an Invoice, with items in one table and payments in the other
                      normally in an invoice you will have items, that is understandable. but why do you have payments too? I am sure you have your reasoning, as I said I am curious.
                      for me I have an invoice which will include all customer_id ( giving access to other info) and items charged, and payments will have customer_id ( giving access to other info) and payments information total of three table, including customer table. is it not the way you have?
                      thanks for reading

                      gandhi

                      version 11 3381 - 4096
                      mysql backend
                      http://www.alphawebprogramming.blogspot.com
                      ggandhi344@gmail.com
                      Skype:ggandhi344@gmail.com
                      1 914 924 5171

                      Comment


                      • #12
                        Re: Submit New - or Rather Saveas New

                        I do have a customers table, an invoice table, a line items(think products), and finally a payments table.
                        The invoice UX is simply the Invoice table, line items and another repeating section for payments. In our industry an invoice might (or might not) contain ongoing charges and payments. For example a company might charge 50$ per animal caught, and might receive multiple payments on a single invoice, it might be a deposit on a job or an agreed on percentage per milestone, etc.

                        What I was trying to accomplish here is an invoice (minus payments of course) that would contain basically an identical customer, and line items - but need to be on separate invoices - so once the first invoice is created you may want to pull up the exact same invoice and "save as new" kind of like a recurring charge.

                        It seems I have peaked a few folks interest so I can't be the only one! I was curious what the use case was for Mike Browns xbasic routine.
                        Sarahs idea is pretty cool and I might try that the next time i run into this again. I am not necessarily hell bent on finding a solution as it isn't all that important but it does seem like a pretty cool button that could be added easily by Alpha if there were a need and of course they felt it was worth spending time on.
                        My guess is Selwyn could whip this up in his sleep tonight, lol
                        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                        Comment


                        • #13
                          Re: Submit New - or Rather Saveas New

                          i see
                          thats how its work..!

                          Comment


                          • #14
                            Re: Submit New - or Rather Saveas New

                            Originally posted by CharlesParker View Post
                            I do have a customers table, an invoice table, a line items(think products), and finally a payments table.
                            The invoice UX is simply the Invoice table, line items and another repeating section for payments. In our industry an invoice might (or might not) contain ongoing charges and payments. For example a company might charge 50$ per animal caught, and might receive multiple payments on a single invoice, it might be a deposit on a job or an agreed on percentage per milestone, etc.

                            What I was trying to accomplish here is an invoice (minus payments of course) that would contain basically an identical customer, and line items - but need to be on separate invoices - so once the first invoice is created you may want to pull up the exact same invoice and "save as new" kind of like a recurring charge.

                            It seems I have peaked a few folks interest so I can't be the only one! I was curious what the use case was for Mike Browns xbasic routine.
                            Sarahs idea is pretty cool and I might try that the next time i run into this again. I am not necessarily hell bent on finding a solution as it isn't all that important but it does seem like a pretty cool button that could be added easily by Alpha if there were a need and of course they felt it was worth spending time on.
                            My guess is Selwyn could whip this up in his sleep tonight, lol
                            see I told you, you will have your reasoning to do what you want to do. I do not want to dwell on this distraction too long away from your original question of duplicating the ux. generally speaking there is charge and people will charge the same thing over and over again saying the 'usual'. same with the payments they pay the same amount every time, the 'usual'. that is what I thought you wanted to do. it is my mistake to assume.

                            duplicating any dialog is not easy to do, hopefully sarah's suggestion will work good. a while back jinx, I am sure, posted lengthy code to duplicate an invoice. if I find it I will post the link.
                            thanks for clarifying.

                            edit: this is one of the threads:
                            http://www.alphasoftware.com/alphafo...plicate+record
                            and I will see where the code was.
                            Last edited by GGandhi; 04-03-2015, 06:33 AM.
                            thanks for reading

                            gandhi

                            version 11 3381 - 4096
                            mysql backend
                            http://www.alphawebprogramming.blogspot.com
                            ggandhi344@gmail.com
                            Skype:ggandhi344@gmail.com
                            1 914 924 5171

                            Comment


                            • #15
                              Re: Submit New - or Rather Saveas New

                              I do have a question, however.
                              when you have some charges to a customer you add them via the ux and it get submitted to the backend. same with payments. so when you create a new invoice you copy the old invoice and add few more ongoing charges, few more payments then submit. what happens to the items that were copied from the old invoice do they get submitted too making duplicate charge and payments or you have some mechanism to throw those away and save only the new one?
                              thanks for reading

                              gandhi

                              version 11 3381 - 4096
                              mysql backend
                              http://www.alphawebprogramming.blogspot.com
                              ggandhi344@gmail.com
                              Skype:ggandhi344@gmail.com
                              1 914 924 5171

                              Comment

                              Working...
                              X