NetTalk Central

Author Topic: How To Automatically print a report when closing a netwebform?  (Read 3733 times)

Neil Porter

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
How To Automatically print a report when closing a netwebform?
« on: January 23, 2019, 08:44:56 AM »
I have a pretty standard NetWebBrowse which also has an NetWebForm linked to it.

The form is designed to capture address information, and once the form has been saved, I return to the browse, and allow the user to press a print button to create a shipping label with the previously entered address information on it.

This all works fine, BUT some users don't like the fact that they are having to save the form and then print the label by pressing the print button. They want the label to print automatically.

I need to be able to achieve this on a user by user basis, as some people want this feature, and others don't.

I'm not sure whether to try and embed some code in the form to try and call the print procedure from there before returning to my browse, or maybe try to modify the SetFromAction routine to try to return to the print procedure rather than the browse.

Does anyone have any experience with this or suggestions?

Regards,

Neil.
Clarion 11.0.13244
NetTalk 11.04

rjolda

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
    • Email
Re: How To Automatically print a report when closing a netwebform?
« Reply #1 on: January 23, 2019, 04:19:53 PM »
Hi Neil,
I will take a stab at it.
There is a ROutine called "PostInsert" - this is where you can massage other data changes After the record is inserted. 1. Start....
I would guess that If you had a UserSetting like p_web.SSV('autoprintlabel', 1) if the logged in user wants to print a label with each insert.
I would then put the code in the PostInsert embed:
 if p_web.SSV('autoprintlabel') = 1
    put in a call to the label printer with information on which label to print   ! I would steal some code on calling the report from another procedure
 end
i am guessing here but a little code and some tweaking might get you there....
You might have to set a server variable with the ID of the record you want to print  ( the ID of the one just inserted)
FWIW,
Ron Jolda

Neil Porter

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: How To Automatically print a report when closing a netwebform?
« Reply #2 on: January 24, 2019, 09:18:30 AM »
Hi Ron,

Thanks for the suggestion, I really appreciate you looking at this.

I did try the PostInsert embed on the form, but that didn't work unfortunately.

I managed to get some help from Bruce during his weekly webinar, and he has pointed me to the GotFocusBack routine in the browse. With a little bit of javascript it looks like I'll effectively be able to "push" the print button for my lazy user :-)

I'm having trouble getting it to work at the moment. I need to wait for the webinar recording to be posted to check what I'm typing, but I don't think I'm going to be far away.

Regards,

Neil.
Clarion 11.0.13244
NetTalk 11.04

rjolda

  • Sr. Member
  • ****
  • Posts: 279
    • View Profile
    • Email
Re: How To Automatically print a report when closing a netwebform?
« Reply #3 on: January 24, 2019, 12:24:23 PM »
Neil,
Javascript - ohhh noooooo.......
I guess  I am going to have to tackle it soon.....
I would be curious as to how you get this going.
I would appreciate it if you would post some info on how you solve this.  might force me to look at javascript....
Thanks,
Ron

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile

Neil Porter

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: How To Automatically print a report when closing a netwebform?
« Reply #5 on: January 29, 2019, 05:00:11 AM »
Just to close this off.

Bruce's solution for this as shown in the webinar works spot on for what I needed.

You just need to be careful to get your single quotes and double quotes right in the javascript otherwise it just doesn't work, and it doesn't give you any clues as to why as far as I could tell.

Regards,

Neil.
Clarion 11.0.13244
NetTalk 11.04