Alpha Video Training
Results 1 to 23 of 23

Thread: Submit New - or Rather Saveas New

  1. #1
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default 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. #2
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default 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?"

  3. #3
    Member
    Real Name
    Dan Hooley
    Join Date
    Jan 2008
    Location
    Washington (State)
    Posts
    343

    Default 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 -

  4. #4
    Member
    Real Name
    Leif Erik Buroe
    Join Date
    Dec 2009
    Location
    Norway
    Posts
    45

    Default 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

  5. #5
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default 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?"

  6. #6
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,732

    Default 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.

  7. #7
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default 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?"

  8. #8
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default 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

  9. #9
    "Certified" Alphaholic mikeallenbrown's Avatar
    Real Name
    Mike Brown
    Join Date
    Nov 2009
    Location
    United States
    Posts
    1,870

    Default 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

  10. #10
    "Certified" Alphaholic TheSmitchell's Avatar
    Real Name
    Sarah
    Join Date
    Apr 2012
    Posts
    1,334

    Default Re: Submit New - or Rather Saveas New

    One line, even...

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

  11. #11
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default 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

  12. #12
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default 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?"

  13. #13
    Member
    Real Name
    Jack Samuel
    Join Date
    Apr 2015
    Posts
    2

    Default Re: Submit New - or Rather Saveas New

    i see
    thats how its work..!


  14. #14
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Submit New - or Rather Saveas New

    Quote 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 at 07: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

  15. #15
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default 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

  16. #16
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default Re: Submit New - or Rather Saveas New

    No that's not the idea at all. A common use would be to open existing record, change the customer info, save as new.
    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?"

  17. #17
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Submit New - or Rather Saveas New

    you mean the customer is new, and copy from an identical record from the past and recreate the new customer charges as it was in the other record from the past since the service will be identical. but not the payments correct? (or may be the deposits were the same too, then copy the payments too?)
    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

  18. #18
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default Re: Submit New - or Rather Saveas New

    Yes it is reasonable to assume an identical charge and payment of course a check number and payment details might vary a little but the idea would be to have an invoice (record) open and you make a couple of edits and simply save as new. This is handy when you give a secretary a stack of invoices for data entry.
    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?"

  19. #19
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Submit New - or Rather Saveas New

    okay here is something for you to try
    create an ux do all the stuff you need to do and an enter an actionscript to save the data to the back end, fill in the popup change to enter a new record.
    now place the cursor on the actionscript and convert it to xbasic. say yes to the pop up. now scroll down in xbasic and look for a line that says
    dim pNRO.cloneExisting as l = .t.
    probably line 75 change that from .f. to .t. ( I already did that )
    now save the ux and run the ux you will have an empty ux and fill it out and submit. when done all the fields will be the same you can change some and resubmit.

    I tested this with a single table. I will test for you if you cannot succeed with an ux with repeating section(s)

    This is handy when you give a secretary a stack of invoices for data entry.
    this should help that
    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

  20. #20
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Submit New - or Rather Saveas New

    I just did a dialog with repeating section works perfect.
    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

  21. #21
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default Re: Submit New - or Rather Saveas New

    Interesting, I am away from computers entirely till tomorrow night. I can't wait to see this working for me! :-)
    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?"

  22. #22
    "Certified" Alphaholic
    Real Name
    Govindan Gandhi
    Join Date
    Aug 2008
    Location
    New York, NY
    Posts
    4,294

    Default Re: Submit New - or Rather Saveas New

    Quote Originally Posted by CharlesParker View Post
    Interesting, I am away from computers entirely till tomorrow night. I can't wait to see this working for me! :-)
    and?
    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

  23. #23
    "Certified" Alphaholic CharlesParker's Avatar
    Real Name
    Charles Parker
    Join Date
    Dec 2012
    Location
    New Orleans, LA
    Posts
    2,119

    Default Re: Submit New - or Rather Saveas New

    Man, unfortunately this has to take a back burner - but rest assured it is marked to re-visit. I was working out a few kinks with Canadian address entry in my app and another issue where customers of my sass users login and can create a service request that will show up in the jobs list and calendar (Jim Coltz Calendar btw)
    so as I said I am busy as always but this particular need is going to take a back seat for a few - thank you for these ideas. This is another benefit of this forum!
    So when I can spend the time to get this working I will test it and let you know what happens and if it will work in the long run for me. This was and is an interesting idea.
    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?"

Similar Threads

  1. Getting one button to submit, and the other to submit and reset.
    By JackByrne in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 10-09-2014, 10:29 PM
  2. How to submit linked child grid upon parent submit?
    By WindForce in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 12-28-2011, 09:09 AM
  3. <object>.saveas()
    By Florian in forum Alpha Five Version 9 - Desktop Applications
    Replies: 3
    Last Post: 07-02-2009, 01:53 PM
  4. How to condense multiple submit buttons to a single submit button
    By kthibeault1965 in forum Application Server Version 9 - Web/Browser Applications
    Replies: 5
    Last Post: 11-20-2008, 09:02 AM
  5. SaveAs
    By David Henderson in forum Alpha Five Version 6
    Replies: 2
    Last Post: 08-31-2004, 01:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •