Normal Topic Use FormAsDialog, then PrintAForm ?? (Read 1955 times)
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Use FormAsDialog, then PrintAForm ??
Apr 3rd, 2013 at 2:27pm
Print Post Print Post  
I have code using Xresult that loops through client data.  Certain conditions will add a data string to a variable.  At the end of the loop, an if condition will want to print that variable string out to a printed page that can be faxed to the client.  to accomplish this without user input, can I use FormAsDialog to load the necessary variables into this 'form', and then use PrintAForm to print this form to the printer?  And then tear it down programmatically and continue on with the next loop?
  

Larry
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Use FormAsDialog, then PrintAForm ??
Reply #1 - Apr 3rd, 2013 at 7:02pm
Print Post Print Post  
Quote:
to accomplish this without user input, can I use FormAsDialog to load the necessary variables into this 'form'

I am not sure if I understood you properly. I find FormAsDialog very useful and use it quite extensively. FormAsDialog is very powerful tool for user interaction. I believe you did not use it that much as you indicated earlier and you did not use ClientLocalValue ( ) command before. You use ClientLocalValue ( ) command to take the value from the form to the Dialog form and dialog form has all sBasic commands available to it. I usually use process button just to close the Dialog form and that gives to the string of all the values from the Dialog form.  Dialog form is for user interaction only.
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Use FormAsDialog, then PrintAForm ??
Reply #2 - Apr 3rd, 2013 at 7:38pm
Print Post Print Post  
Following is the example of @FormAsDialog ( ).

Code
Select All
vString = RecNumber + ";" + vChart

					ClientLocalValue ("RecipientData", "")
					ClientLocalValue ("RecipientData", vString)

					vResult = @FormAsDialog ("Dialog_Document")


					//Here Dialogform opens up and
                                      //hitting process button or simply closing the form, gives string of Element Name and Element Value separated by "=" to vResult variable.
                                  //You are in the original form here




					//WriteLn (vResult)

					vResult = @Replace (vResult, "=", ";")

					vRecNumber = @AccessStringArray (vResult, 2)
					vDateAdded = @AccessStringArray (vResult, 4)
					vChart = @AccessStringArray (vResult, 6)
					vMethod = @AccessStringArray (vResult, 8)
					vView = @AccessStringArray (vResult, 16)
					vDescription = @AccessStringArray (vResult, 20)
					vFileName = @AccessStringArray (vResult, 22)

 

  
Back to top
 
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Use FormAsDialog, then PrintAForm ??
Reply #3 - Apr 3rd, 2013 at 9:54pm
Print Post Print Post  
Hi Bharat,

You're correct - I haven't used @FormAsDialog before.  But this calc I'm programming is to alert clients - most of the clients will receive this alert via email (by @sendmail), and that part works beautifully.  For the clients without email (or at least don't want alerts delivered to them via email) I must print the alert and then fax the printed alert to them.  There may be 50 or 80 alerts to print and fax.  If I 'writeln' the alert, then I can print each alert (with different client info on each one) individually, but that is too tedious to contemplate on a weekly basis.  And the same variable that displays so perfectly with writeln, I'm having trouble with Printstring printing the same variable.   Printstring is so tedious it makes me want to pull my hair out, and I am resisting the anticipated hours of trial and error I'll need, just to print some simple text on a sheet of paper.   So I thought, well maybe I can make a new Form for my Client database (the new form just having 3 unbound fields - Client name, Client fax#, and a big editor text box to paste in the alert data), I could have code call it up, load it, then use PrintForm to print that FormAsDialog, then throw it away and move on to the next loop.   here is an example of the simple text alert that I need Sesame to print automatically.  Heretofore, PrintString just prints the header, but none of the product data lines, although the messages email beautifully.  I was trying to think outside the box a bit. 

Actually, maybe just making a new form (ClientFax or some such) for Client database, and put the command button to run this calc in that form is my answer.  All of the calc is done with XResultSet commands, so maybe XResult could just make a new ClientFax record, load the variable into a big  unbound text editor field or multiline field, then PrintAForm that current record, then delete the contents of the field, and loop to the next client, etc.  ??? 


Or maybe I just need to 'man up' and tackling PrintString arcanity.  But that kind of tedious pixel placement and testing usually makes my neck lock up  Cry

Fax: 555-2286

Need Soon Report from WordCom, Inc
Hi,
1007N / Customer ENGINEERING, DEAN'S OFFICE

WordCom's wise, all-seeing White Owl Software suggests that
you are due to order the following products - please contact us
via fax 918-our-fax#, phone 918-our-phon#, or email ouremail@ourweb.com.
We appreciate you !!!


Reorder Date for 4 CTN of ItemNum #1-5511G / Paper, WC, 8511-20, 20# 92-BRITE WHITE COPIER/LASER PAPER #851001HS - G packaging, High Speed
should be 2013/04/02
  

Larry
Back to top
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: Use FormAsDialog, then PrintAForm ??
Reply #4 - Apr 3rd, 2013 at 10:07pm
Print Post Print Post  
Have you looked into one of those services that converts emails to faxes?

http://www.myfax.com/lp/freetrial.aspx
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Use FormAsDialog, then PrintAForm ??
Reply #5 - Apr 3rd, 2013 at 10:34pm
Print Post Print Post  
MergeFilePrint ( ) will print the records using loop. Would you be printing to Fax printer? Or do you have a fax server?  You could use Commandline fax program to pass on the fax# and name. It will be a little slower as compared to Printstring as it has to open up the MS Word and close for each fax.


MergeFilePrint(vPath , "rtf", "", "", vExtFields, "", 0) //File will print without displaying
  
Back to top
 
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Use FormAsDialog, then PrintAForm ??
Reply #6 - Apr 3rd, 2013 at 10:43pm
Print Post Print Post  
Guys,

I just created a ClientFaxForm form for my Client database, put one big text editor multiline field in it.  Below is the relevant piece of code that prints the one field form, then deletes the field contents, then goes on to the next loop.  It worked like a charm!

Your other ideas are good ones.  I hadn't considered either one of those.  I will look into them as a more automated solution.

                                   FormFieldValue("", "NeedSoonBox", 0, vNeedSoonFYI)
                                   vPrintForm = @PrintAForm(0, 0, 1, 0, 28,-1, -1, -1, -1, 1, 1)
                                   FormFieldValue("", "NeedSoonBox", 0, "")
  

Larry
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Use FormAsDialog, then PrintAForm ??
Reply #7 - Apr 4th, 2013 at 5:12pm
Print Post Print Post  
Hello Larry,

I'm not understaning the use of FormFieldValue() in this case. You are on that form, so can't you just use

Code
Select All
NeedSoonBox = vNeedSoonFYI
vPrintForm = @PrintAForm(0, 0, 1, 0, 28,-1, -1, -1, -1, 1, 1)
Clear(NeedSoonBox) 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Use FormAsDialog, then PrintAForm ??
Reply #8 - Apr 5th, 2013 at 2:13am
Print Post Print Post  
Ray, I'm at the end of a long car travel day.  Checked into the hotel, looked at your message, and laughed out loud.  Thanks!!!

Well, you're having trouble understanding my coding because - judging from your method - you obviously like to do things the easy way.   Tongue   Unlike me, where it's almost always main strength and awkwardness  Cry   Hence, my laughter at being called out (albeit in a charming and helpful way!).

Yes, your way is much better.  I will make that change (I'm a slow learner, but I'm not stubborn  Smiley )

  

Larry
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Use FormAsDialog, then PrintAForm ??
Reply #9 - Apr 5th, 2013 at 1:24pm
Print Post Print Post  
Glad I could help. Smiley

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged