NetTalk Central

Author Topic: Partial Save?  (Read 2563 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • Email
Partial Save?
« on: May 22, 2024, 12:40:33 AM »
Hi,

If I want to update other fields in the record, how and where do I set them using a partial save button?
Do I set the session variables, the actual record fields or how?

Have tried, but for some reason the data is not being written to disk,
the partial save works, and it saves the fields from the page, but not the ones I set in the embed.
I did move the code to the embed before the save code. 

thanks

Johan


rjolda

  • Sr. Member
  • ****
  • Posts: 315
    • View Profile
    • Email
Re: Partial Save?
« Reply #1 on: May 25, 2024, 02:16:17 AM »
Johan,
What are you working with - a Form or MemForm?
There are several methods available for Before writing to file and after writing to file.  Make sure your code is in the Before writing to file.
Ron

JohanR

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • Email
Re: Partial Save?
« Reply #2 on: May 25, 2024, 06:33:15 AM »
Hi Ron

Thanks,
but am using buttons on the form to save the form but leave it open, or if it was inserted will save and convert to a change record situation.
Very useful.

eg.
User is doing a quote in insert mode, and if he's happy , converts the quote to a confirmed order.
This way the user can confirm, and keep editing and update the other required information without leaving the page, name, address etc..but the order has been confirmed and saved.
Or he decides to add to to next the despatch , and don't want that add to happen with a record that is in insert mode.


regards

Johan




JohanR

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • Email
Re: Partial Save? (extra info)
« Reply #3 on: May 25, 2024, 06:50:00 AM »
Hi,

Further info , this works if the field you're changing is on the page.

   ord:special_instructions = 'Partial save2222'
   p_web.SetValue('ord:special_instructions',ord:special_instructions)

if the field that your changing is not on the page, then you have to set the session variable as well.

   ord:special_instructions = 'Partial save2222'
   p_web.SSV('ord:special_instructions',ord:special_instructions)
   p_web.SetValue('ord:special_instructions',ord:special_instructions)

regards

Johan


rjolda

  • Sr. Member
  • ****
  • Posts: 315
    • View Profile
    • Email
Re: Partial Save?
« Reply #4 on: May 26, 2024, 12:38:09 PM »
Johan,
I constantly get stuck with this - Bruce keeps correcting me.  So here is it.  There is NO FORM!  It does NOT EXIST!.  So, when user is on "Same FORM" - that really does NOT MEAN ANYTHING!. 
Bruce said "Think of the Form as a series of EVENTS" - User sends a Request EVENT to server and Server Responds.  Then the connection is CLOSED.  If you open a form, THe record is read into SESSION variables and the Record itself is GONE!.  So,  Everything you do is an EVENT.  Because the SESSION ID is passed back and forth between the User ( Browser ) and Server, the SERVER VALUES are always accessible by SessionID - the record itself is NOT available. At the End of the form - when you press SAVE or DONE - the Server is instructed to fetch the record and update it with the ServerValues for that session ID.  Does that make sense?
I am doing some things like your user.  I am pulling out a record and putting some settings in it.  Then the user ( still on the same MemForm) is pressing buttons to do different actions.  For each of these actions, I have to take their new values, Stuff them into the Session Values, fetch the record and write them to the record itself. 
In other words, the Session Values are the thing that the user is interacting with ( as a representation of the record itself..).  Therefore if you are going to do a partial save, Update the Session variables.  At this point I am going to fetch the record and write the values directly to the record and update it without using the p_web.recordtovalue and p_web.Values to Record functions.  (Not sure that these are the correct names but they are in the p_web settings.  i will keep the Session values updated as they are the "representative state" of the "record".   At the end, I could to a values to record save but I might just roll my own and update the fields that i want.
Since the Updates to the record are under YOUR CONTROL in the EMBEDS  - you can check to make sure that your data got written to the record with the
If not Access:File.Update() = Level:Benign
  then ALERT USER.
You can also use the Access:File.tryUpdate() function.
Hope that this explanation helps you.
Ron