NetTalk Central

Author Topic: Save and Next for NetWebForm Again  (Read 4246 times)

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Save and Next for NetWebForm Again
« on: April 25, 2013, 07:26:48 PM »
Hi Bruce,

I never got the “Save and get next record” in a NetWebForm to work in my application as it in the example application you prepared for me last year.   As per thread:
http://www.nettalkcentral.com/index.php?option=com_smf&Itemid=36&topic=3526.msg13994#msg13994

The objective was to press a “Save and Next” button on the form and input is validated and saved as usual,  but instead of returning to the browse, the same form is loaded  with the next record in the browse.  The technique that you provided back in July of last year worked in the simple example program. But on more complex forms, the technique does not work. Last year, I was able to make a workaround by using a “Submit” button instead of  a “Save” button for the “Save and Next” function that effectively did the save of the edited records as if in a memory form. If a “Save” button is used for the “Save and Next” function initial record is saved, however when the next record is loaded into the form, the form and will not save or validate the record when any of the save buttons on the form are pushed.

However now I want to create a form that will validate and save updates on form using the  “Save” button because I will have a number save buttons on the form that will do different things before saving.  I modified my View01 example program to simulate the problems that I am having with my current project. My current project does not use the same tables, but the View01 example displays the same problems.  Compile View01.app and start the  program. Click on the “Multi-Table Example” button.  Select the first record and press the Change button. The ViewUpdateForm procedure form is displayed. This is the NetWebForm that I have tried to add a Save and Next buttons. The has four plain tabs on the form, a  tab for each of  three tables that are updated with this form and a tab for the update buttons. In the buttons tab there is a “Retrieve Next Record”  check box. When checked, the save buttons should update the changes to the tables and retrieve the next S_AMASTER record and retrieve the records from related tables and display the form again.   When unchecked the “Save” buttons save the current tables and return to the browse.  Enter changes to the fields on the form, and  press the “save” button. When the “Retrieve Next Record”  is checked,  these changes are properly saved and the next S_AMASTER record is retrieved by my GetNextRecord routine and loaded with the records from related tables into the form.  Now there are two issues:

1) You will notice that only the S_AMASTER fields have the next record values, even though the records from the related tables are retrieved and loaded in to Session Variables. (see debug trace), they still show the previous record values.  Also if you recompile the program and allow the “AssignedDate” field in the S_AMASTER tab be displayed. The Assigned Date field in the U_MASTER tab will show the correct value of the related U_MASTER record, but the other U_MASTER fields still show the previous record values. Weird.
2) You can not update or validate the records using the “Save” buttons now. Pressing the “Save” button just links back to the browse. Also no further stages are executed including the stage that executes the PostUpdate embed that contains the code from your Web1 example to call the form again. Basically the NetWebForm is not setup properly as it when called from the browse when updating the selected record. I think there must be some value queue fields that must be reset.


The code to the “Save and Next” is in the five embeds within the form, I believe the code is easy to understand.  I uploaded both the View01 app and the Web1.app example that contains the code that you prepared to do the Save and Next last year.  Currently, I am using NT 7.06, I did not realize that we are up to 7.10 already. Looking at the version update history, I do not think the newer NT version will make a difference.   I hope that you can help me. Please post if you will give it a try.

Thank-you,
Rob Kolanko


[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next for NetWebForm Again
« Reply #1 on: April 25, 2013, 09:43:08 PM »
Hi Rob,

I'm not surprised this is a difficult task, I remember taking a look last time and figuring out that it was gonna get really complicated really quickly. There are a lot of items to take into account, and it's not trivial to change the "architected flow" to do things like this.

Unfortunately, and just by way of an FYI, I've got an event coming up on May 11, so I won't be able to spend the time I need to on this before at least then. Hopefully we can get something out later in May, but please bump this thread if it looks like nothings happening by May 15.

cheers
Bruce


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Save and Next for NetWebForm Again
« Reply #2 on: May 14, 2013, 02:56:28 PM »
Hi Rob,

Have you thought about moving to a memory form and adding your own buttons for save and save next? It should be easy enough to do a rough prototype to see if it works or not.

Kev

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next for NetWebForm Again
« Reply #3 on: May 15, 2013, 10:02:37 AM »
Hello Kev,
I believe that a memory form will be my last resort. There are some weird things that appear when I resend the form after the update, that may go away or I could fix when using a memory form. The problem is that once you do not let Nettalk perform the update on the primary table, the form returns to the browse at the same record that the change was called. This confuses the user as he may not see that he has updated a range of records. I would like to keep the Nettalk's browse and form relationship, if at all possible.
Hopefully Bruce will help me.
Rob

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Save and Next for NetWebForm Again
« Reply #4 on: May 15, 2013, 03:36:51 PM »
Hi Rob,

"The problem is that once you do not let Nettalk perform the update on the primary table, the form returns to the browse at the same record that the change was called."

There are a couple of ways you "may" be able to fix this.

If your browse is embedded in a form you can add parameters for the browse on the template.

I have a custom lookup browse that is called from a normal button. I have the following parameters set so it lands on the closest match:
'ChartOfAccountsLookupBrowse_Sort' with value 2
'_refresh_' with value 'locate'
'Locator2chartofaccountslookupbrowse_chartofaccountslookup' with value p_web.GSV('P:ChartCode')

or

there was an anchor option added for browse fields. Haven't used so not sure where or how to set but maybe useful.

Cheers,

Kevin


Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Save and Next for NetWebForm Again
« Reply #5 on: June 04, 2013, 05:50:44 AM »
Hi Bruce,
Bump up- How about looking at this problem now?
Thanks Rob

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Save and Next for NetWebForm Again
« Reply #6 on: June 04, 2013, 06:46:45 AM »
[note - I deleted some earlier bumps, just so this thread doesn't get too long and earn the "blank thread" issue].

I've been thinking about it some more Rob, while I've been refactoring. The 7.11 build has got some fairly significant changes under the hood which may, or may not, make this effect a bit easier. Time will tell I guess. So while nothing appears to be happening on the surface this is still on my to-do list, and hopefully I'm working towards a point that makes it easier.

Cheers
Bruce