Baanboard.com

Go Back   Baanboard.com > Forum > Baan SIGs > Code & Utilities

User login

Frontpage Sponsor

Main

Google search


Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
36%
Installation Wizard into new VRC
36%
Manual into existing VRC
7%
Manual into new VRC
20%
Total votes: 44

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #16  
Old 14th November 2003, 18:16
Pilekes's Avatar
Pilekes Pilekes is offline
Junior Member
 
Join Date: Jul 2003
Location: Netherlands
Posts: 4
Pilekes is on a distinguished road
Baan: IV - DB: Oracle - OS: Win2000
I was trying to rename a file after I had read its info into a table (2 actually, but ok) and save this file clientside with a unique name.
So I thought of using an extension .000 - .999 so if server2client would fail it would mean .000 had to be increased to .001.
But since server2client overwrites the file I was trying to make it read-only...
Since I couldn't get this to work I used a date&time stamp instead ;)
So now the name of the file is like YYYYMMDDHHMMSS.txt that was a lot easier, since now I don't have to set read-only to the files.
So now my program works :)

Thanx 4 the effort anyway!
__________________
One day I am gonna find peer and reset HIS connection!
Reply With Quote
  #17  
Old 19th December 2003, 21:27
rzamora's Avatar
rzamora rzamora is offline
Junior Member
 
Join Date: Oct 2002
Posts: 5
rzamora is on a distinguished road
Thumbs up How to compile it propertly?

I am new in the Baan word.
I find your code very interesting y and I want to probe it, but I don´t know how to compile it.
Sorry, but can you help me.

Thanks

Ralph
Reply With Quote
  #18  
Old 26th May 2004, 14:49
Reshma Reshma is offline
Unconfirmed User
 
Join Date: Feb 2004
Posts: 3
Reshma is on a distinguished road
Baan: BaaN IV - DB: Informix - OS: Unix
HELP REQD ...

I would like to know that after the parameters are passed to the script, the format of main function for getting the parameters using argv$() and checking them.
Reply With Quote
  #19  
Old 26th May 2004, 15:05
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,061
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not sure

I am not sure I understand the question. Anyway you can use argc$() to see how many parameters are passed. Then you can set variables to the argv$() and check them. For example if your first argument was project, you could set a variable project=argv$(1). Then use tt.align.according.domain to get the correct justification and then check against a table. I am not sure if the variables are all passed as strings.

Mark
Reply With Quote
  #20  
Old 28th September 2004, 19:38
ltannous's Avatar
ltannous ltannous is offline
Senior Member
 
Join Date: Sep 2002
Location: Canada
Posts: 280
ltannous is on a distinguished road
Baan: 4c4 - DB: Oracle - OS: UNIX
Data in excel is located in one row/column

this program started excel, but the data is in text format and each line of data is in one cell/row. How can this work so the the rows/columns of data are separated??
Reply With Quote
  #21  
Old 28th September 2004, 19:49
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,061
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
The code and thread were just an example of how you could write your own device driver. There are actually several ways to accomplish this - use the tool ~Vamsi posted, NAZDAQ program, etc. Or you could modify a report to put the data in a comma delimited format, download and run it. Or as you see at the beggining of the thread a method where we created a table to hold macro information by report. When our device is selected it downloads the file to the PC and launches an excel macro to format the report according to our users wishes. The macros are stored by site and report name - this way we could format the same report differently for each of our sites.

Our simple excel device does not use a custom "ottstpconv" program. It downloads it and launches excel. The data is in the format you mentioned - all in one row. Our users know to use the text to columns option under data on the menu.

Mark
Reply With Quote
  #22  
Old 22nd November 2005, 22:57
jroberts's Avatar
jroberts jroberts is offline
Senior Member
 
Join Date: Nov 2001
Location: Guelph, Canada
Posts: 103
jroberts is on a distinguished road
Baan: Baan IVc4 SP5 - DB: Oracle 8.0.5 - OS: NT 4 SP 5
Question : How to import variables into ttconv sample

Thank you very much for the sample, it is very interesting.

We modified the sample so that it would email the Baan Print File to the users. We want to be able to pass the email data;
  • email subject
  • email to address
  • email from address
  • email message body
from the calling program to the tuddcconv4 device driver.

If we print manually, and put the email data into the input string variables, it sends the bpf as expected. We are using 'BLAT' to actually send the email.

Now my problem:
I can't make the tuddcconv4 script import the email data that I have exported in my source program.

Is there a special function to import variables from a 4GL script into a 3GL script ?

main program :
Code:
choice.cont.process:
on.choice:
	export("email.from", email.from)
	export("email.to", email.to)	
	export("email.body", email.body)
	export("email.subject", email.subject)
	export("email.attach.send", email.attach.send)
tuddcconv4 :
Code:
|******************************************************************************
|* Title	: tuddcconv4 - email bpf to user
|* Author	: John Roberts
|* Co-Author	: Bert Klunder
|* Date		: <2005-Nov-22> 
|******************************************************************************
|* Script Type	: Library
|* Description	: 
|* Category	: Utility to email bpf
|* License	:
|* Copyright 2005 by Bert Klunder & John Roberts
|* 
|* All Rights Reserved 
|* 
|* Permission to use, copy, modify, and distribute this software and its
|* documentation for any purpose and without fee is hereby granted,
|* provided that the above copyright notice appear in all copies and that
|* both that copyright notice and this permission notice appear in
|* supporting documentation. 
|* 
|* Bert Klunder, John Roberts and Baanboard.com DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|* AND FITNESS, IN NO EVENT SHALL <author> nor Baanboard.com BE LIABLE FOR ANY
|* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
|* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
|* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|* OR PERFORMANCE OF THIS SOFTWARE.
|******************************************************************************
                        long            ret, rc, i
         extern  domain	tcmcs.str100    email.attach, email.from, email.server, email.to, email.body, email.attach.send, email.subject
           		string		application(300)

        #pragma used dll ottdllbw
        #pragma used dll ottdllinputstr

	string 		path.file(128)		|Log file path
	long		fp.file

function main()
{

        email.from = strip$(argv$(2))
	email.server = strip$(argv$(3))
	email.attach = strip$(argv$(1))
	write.log.line("Temp File Name : " & email.attach)
	write.log.line("Email.From : " & email.from)

	get.var(parent,"email.to",email.to) 
	get.var(parent,"email.attach",email.attach) 
	import("email.from", email.from)
	import("email.to", email.to)
	import("email.body", email.body)
	import("email.attach.send", email.attach.send)
	
        message("email.to :" & strip$(email.to))
        message("email.attach :" & strip$(email.attach))
        if not job.process then
        	if strip$(email.to) = "" then
		ret = input.string("Destination", "Enter list of recipients seperated with a ',' no spaces", 100, 50, email.to)
		endif

	        for i = 1 to len(email.to)
        	        if email.to(i;1) = chr$(34) then
                	        email.to(i;1) = "."
        	        endif
	        endfor
	        if strip$(email.subject) = "" then
		ret = input.string("Subject", "Please enter a subject for the email", 100, 50, email.subject)
		endif

	        for i = 1 to len(email.subject)
        	        if email.subject(i;1) = chr$(34) then
                	        email.subject(i;1) = "'"
        	        endif
	        endfor
	        if strip$(email.body) = "" then
		ret = input.string("Email Body", "Enter text for the email body", 100, 50, email.body)
		endif

	        for i = 1 to len(email.body)
        	        if email.body(i;1) = chr$(34) then
                	        email.body(i;1) = "'"
        	        endif
	        endfor
	        if strip$(email.attach.send) = "" then
		ret = input.string("Attachment", "Enter a name for the file to be sent", 100, 50, email.attach.send)
		endif

|		check to make sure no illegal characters have been used for the attachment name. Change to a "." if it has
	        for i = 1 to len(email.attach.send)
        	        if email.attach.send(i;1) = "/" or 
        	        	email.attach.send(i;1) = "\" or 
        	        	email.attach.send(i;1) = ":" or 
        	        	email.attach.send(i;1) = "*" or 
        	        	email.attach.send(i;1) = "?" or 
        	        	email.attach.send(i;1) = chr$(34) or 
        	        	email.attach.send(i;1) = "<" or 
        	        	email.attach.send(i;1) = ">" or 
        	        	email.attach.send(i;1) = "|"
        	        	then
                	        email.attach.send(i;1) = "."
        	        endif
	        endfor

	else

        endif

	email.file()

}

function email.file()
{
	long appid 

        | make sure the final file has a valid extension
	appid = file.cp(email.attach, email.attach.send & ".bpf")
	
        for i = 1 to len(email.attach.send)
                if email.attach.send(i;1) = "/" then
                        email.attach.send(i;1) = "\"
                endif
        endfor
        
	application = "/c blat c:\temp\blank.txt -t " & strip$(email.to) & 
	" -f " 	& email.from & 
	" -attach " & chr$(34) & email.attach.send & ".bpf" & chr$(34) &
	" -server " & email.server & 
	" -body " & chr$(34) & email.body & chr$(34) &
	" -S " & chr$(34) & email.subject & chr$(34)
	& " -log c:\temp\blat.log"


	appid = run.prog("cmd.exe", application, RP_NOWAIT)
}


|**************************** end of script *****************************
Reply With Quote
  #23  
Old 23rd November 2005, 15:57
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,061
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
In the old days (before management rejected my program) I had an email device. I can not find a copy of the calling program. I do remember it called a 4gl session to prompt for the subject, etc. I could have sworn I used import/export.

Try making it(your conversion session) a 4gl program - the form can just be blank. I believe the argv params will still be the same. Then in the init.form section you can do something like this:

Code:
form.1:
init.form:
	import("mess", parm)
	execute(cont.process)
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #24  
Old 23rd November 2005, 17:04
vahdani's Avatar
vahdani vahdani is offline
Guru
 
Join Date: Aug 2002
Location: Cologne, Germany
Posts: 437
vahdani is on a distinguished road
Baan: all - DB: all - OS: Unix / Win2K
Hi John,

use get.var in your 3 GL script, in following example I get the name of the session printing the report:

Code:
function main()
{
	extern	string	print.session(20)
	extern	long	session.id

	import("parent", session.id)
	get.var(session.id, "prog.name$", print.session)
	.....
}
__________________
May the force be with you!
Reply With Quote
  #25  
Old 23rd November 2005, 17:36
jroberts's Avatar
jroberts jroberts is offline
Senior Member
 
Join Date: Nov 2001
Location: Guelph, Canada
Posts: 103
jroberts is on a distinguished road
Baan: Baan IVc4 SP5 - DB: Oracle 8.0.5 - OS: NT 4 SP 5
get.var worked

Thanks for the help,

I changed my import statements to be get.var statements :

Code:
	import("parent", session.id)
	get.var(session.id, "email.from", email.from)
	get.var(session.id, "email.to", email.to)
	get.var(session.id, "email.subject", email.subject)
	get.var(session.id, "email.attach.send", email.attach.send)
	get.var(session.id, "email.body", email.body)
and now the script works, and emails users bpf files.

Thanks very much for the help.
John
Reply With Quote
  #26  
Old 24th November 2005, 13:39
vahdani's Avatar
vahdani vahdani is offline
Guru
 
Join Date: Aug 2002
Location: Cologne, Germany
Posts: 437
vahdani is on a distinguished road
Baan: all - DB: all - OS: Unix / Win2K
Hi John,

glad to e of some help! Maybe in return you can tell me how you create your pdf's.
__________________
May the force be with you!
Reply With Quote
  #27  
Old 24th November 2005, 14:18
jroberts's Avatar
jroberts jroberts is offline
Senior Member
 
Join Date: Nov 2001
Location: Guelph, Canada
Posts: 103
jroberts is on a distinguished road
Baan: Baan IVc4 SP5 - DB: Oracle 8.0.5 - OS: NT 4 SP 5
We are not creating pdf's but using bpf

Using the other posts in this thread & ghost script,
we have tested the creation of pdf's before,
but we are distributing bpf's via the automated e-mail.

Sorry,
John
Reply With Quote
  #28  
Old 24th November 2005, 14:38
vahdani's Avatar
vahdani vahdani is offline
Guru
 
Join Date: Aug 2002
Location: Cologne, Germany
Posts: 437
vahdani is on a distinguished road
Baan: all - DB: all - OS: Unix / Win2K
Talking

oh I get it bpf as Baan Print File!

Sorry I misread!
__________________
May the force be with you!
Reply With Quote
  #29  
Old 11th January 2006, 08:12
Kingsto88 Kingsto88 is offline
Senior Member
 
Join Date: Oct 2004
Posts: 208
Kingsto88 is an unknown quantity at this point
Baan: Baan 4, Baan 5 - DB: SQL server, Informix - OS: Windows 2000, HP Unix
launch excel

Hi Mark,

Will your suggestion above, launch excel everytime during print.

Can I print to file with excel format without launching excel.

Thanks and regards,
Reply With Quote
  #30  
Old 11th January 2006, 15:25
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,061
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
With this solution you can pretty much make it do what you want. In this example it should launch excel every time. We have another version that launches excel with a different macro for a defined report.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code: Sample Qkey Script mark_h Code & Utilities 7 9th December 2013 14:33
Sample AFS code for Baan V DStroud AFS/DDC/OLE: Function servers 2 29th September 2004 16:59
I need to Change the Item Code after creating the production order baanlegend Distribution, Transportation & Warehousing 5 23rd July 2004 11:42
NEW: vbcode CODE extensions patvdv About Baanboard.com 3 13th March 2003 11:19
need sample code for API / AFS rohan_rege AFS/DDC/OLE: Function servers 4 9th September 2002 16:58


All times are GMT +2. The time now is 11:58.


©2001-2017 - Baanboard.com - Baanforums.com