Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
18%
200 - 500 GB
29%
500 - 800 GB
3%
800 - 1200 GB
8%
1200 - 1500 GB
8%
1500 - 2000 GB
12%
> 2000 GB
23%
Total votes: 77

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 25th April 2019, 13:26
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 35
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
dir.open()
Baan: ERP LN 6.1 FP9 (Infor ERP 10.3)
C/S: None/Unknown

Hi

Does dir.open() open directory from local machine or server?
Reply With Quote
  #2  
Old 25th April 2019, 13:30
eduardourra eduardourra is offline
Junior Member
 
Join Date: Jan 2006
Posts: 5
eduardourra is on a distinguished road
Baan: LN ERP - DB: Oracle 10e - OS: Win 2000
Hi,

dir.open() work on server side
Reply With Quote
  #3  
Old 25th April 2019, 13:35
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 35
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
If i want to open local folder, is there any function available?
Reply With Quote
  #4  
Old 25th April 2019, 16:29
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,373
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Not that I am aware. Search on dir.open and look at the threads. The older ones talk about executing commands to move the folders to the baan server.
__________________
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
  #5  
Old 25th April 2019, 20:30
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,820
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox Tools 10.7 - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
Look at your DEV-Guide

Quote:
Originally Posted by Arlina View Post
Hi
Does dir.open() open directory from local machine or server?
Client file access overview:
Code:
Client file access overview
Use these functions to perform various operations on client files and other client operations – for example:

to open, read, write to, close, and delete files on a client
to show a file open or directory chooser dialog on a client
to transfer files between client and server
to retrieve client file information
to create and delete directories on a client
to start an application on a client
to retrieve client hostname and IP address
to show a color selection dialog on a client
Note 
You can use most of these functions both with the Baan Windows and with the Webtop client. However, some functions are only supported for the Baan Windows client and therefore deprecated.
Code:
Client file access synopsis

long
 client2server() ( string source, string dest, boolean text.mode [, boolean rm.file] [, boolean progress.window] ) 

long
 create.local.directory() ( string dirent ) 

long
 create.local.file() ( string filename ) 

long
 dir.select.dialog.local() ( ref string dirent ) 

long
 get.client.hostname() ( ref string hostname ) 

long
 get.client.ip.address() ( ref string ip.address ) 

string
 get.local.filename() ( ) 

long
 remove.local.directory() ( string dirent ) 

void
 remove.local.file() ( string filename ) 

long
 seq.fstat.local() ( string filename, ref long nr.bytes ) 

long
 seq.open.dialog.local() ( const string defaultname, const string directory, const string filter, ref string filename ) 

boolean
 seq.open.dialog.next() ( ref string filename ) 

long
 seq.saveas.dialog.local() ( const string defaultname, const string directory, const string filter, ref string filename) 

long
 server2client() ( string source, string dest, boolean text.mode [, boolean progress.window] [, boolean read.only] ) 

long
 start.application.local() ( const string commandline, boolean waitFlag, reference long exitCode, [const string verb] ) 

void
 color.dialog() ( reference long io.color ) 
 
Deprecated functions
long
 app_start() ( string commandline, string directory, string stdin, string stdout, string stderr ) 

long
 app_status() ( long app.id ) 

void
 seq.close.local() ( long lfn ) 

long
 seq.open.local() ( string filename, string mode(2) [, long remove.after.use] ) 

long
 seq.read.local() ( ref string buf, ref long size, long lfn )
or sec.local functions
Code:
seq.open.local()
Syntax:

function long seq.open.local  (string filename, string mode(2) [, long remove.after.use])

Description

Deprecated. This function is only supported for Baan Windows and its usage is therefore deprecated. Instead you should use functions: server2client() or client2server().

This opens a specified file on the client system. It returns a file pointer, which you can use to identify the file in subsequent operations.

Arguments

string filename The name of the file that must be opened. If you do not specify a path name, the file is searched for in the directory where BW is loaded.
 
string mode(2) The mode in which the file must be opened. This can be one of the following options:

"r" Open for reading.

w" Create for writing.

"a" Open for writing at end of file, or create for writing.

In addition, you can add "t" to any of the above options if you want the file to be opened in text mode.
 
[long remove.after.use ] Use this optional argument to specify whether or not the file must be removed after it has been closed by seq.close.local():

<>0 file is removed
0 file is not removed
 
Return values

>=0 Success. File pointer is returned. 
<0 Error. File could not be opened. 
 
Context

This function can be used in all script types.

Note 
You cannot use Client file access overview functions in combination with the seq.*.local() functions. So, you cannot use seq.seek() or seq.rewind(), for example, on a file that was opened with seq.open.local().

Example
seq.open.local("C:\Program Files\Test.txt", "rt", false)
Regards
__________________
//Bernd
Reply With Quote
  #6  
Old 26th April 2019, 06:43
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 35
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
I came across these functions. But I need functions which can handle local folder the way dir.open() is doing with server, without opening an dialog box as I need these functions for automation.

We have files in local folder.
Currently user selects Sales Quotation from overview session, click on Attachment button on the session, answers "File Linking" on the following question, then session dmdoc4540m002 appears.User than fills the details and browse file from the local folder and upload it.

We need to automate it now and run it through job.
The issues I am facing is
How to get file from local folder path (eg.C:\upload\<Quotation No>\) and use it in stpapi.put.field( "dmdoc4540m002", "filename", "file_from_local_folder")?As I am not getting any function like dir.open() for local folder

Any suggestions?

Last edited by Arlina : 26th April 2019 at 13:20. Reason: Update
Reply With Quote
  #7  
Old 26th April 2019, 14:45
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,373
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
If you know the directory is c:\upload\<quotation no> here is what I would do. As part of the automation I would either have the user to give me the quotation number. Then I would use seq.open.local on the file name to make sure the file exists - if not I would generate an error or give the user a message. After opening the file I would close it with seq.close.local. If it existed I would then use client2server to move the file to some place on the baan servers.

Code:
function domain tcbool open_file()
{
	long rc
| Create temporary file to copy the PC file to
	temp.file = creat.tmp.file$(bse.tmp.dir$())
        temp.file = strip$(temp.file)

| Open PC file to make sure it exists.
        inputfile = seq.open.local(input.file,"r",0)
        if(inputfile<0) then
		file_err(inputfile)
		return(true)
        endif
	seq.close.local(inputfile)
	rc = client2server(input.file,temp.file,0)

| Open Server file for processing.
        inputfile = seq.open(temp.file,"r")
        if(inputfile<0) then
		file_err(inputfile)
		return(true)
        endif
	return(false)
}

Now if when you run you need the file names, then what you could do is run a dos command, put the c:\upload\ files names into a txt file. Upload and read the file on the server. I think I saw something like that when I searched on dir.open. Let me see if I can find it again. Here is one such thread http://www.baanboard.com/baanboard/s...ight=dir.entry.

The api code is completely different - never done any kind of attachments with a function server of any sort.
__________________
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
  #8  
Old 28th April 2019, 10:44
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 35
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
What we require is to run the automation without user intervention (as a job probably).
The program needs to find all the subfolders(named as per sales quotation no.) in C:\upload\
For available quotation no. it would run AFS of Sales Quotation Overview and handle File linking session as subprocess to upload the file with path C:\upload\<Quotation no.>\<filename>
Basically I need the local path of each file, not to open the file but to put it as an input in File Linking session.
Attached Images
File Type: png File Linking Session.png (50.0 KB, 15 views)

Last edited by Arlina : 28th April 2019 at 10:54.
Reply With Quote
Sponsored Links
  #9  
Old 2nd May 2019, 10:23
Arlina Arlina is offline
Member
 
Join Date: Feb 2019
Posts: 35
Arlina is on a distinguished road
Baan: Infor LN - DB: MSSql - OS: Windows
Thanks all.
Finally what I used is
path.client= "C:\temp\ODM\"
cm = app_start("cmd.exe /C " &
"dir /AD /B /ON /S "&strip$(path.client)&
" >" & strip$(listd.f),
"", "", "", "")
suspend(1000) |to list of folders' path

|move listd.f to server using client2server()
.
.
.

cm1 = app_start("cmd.exe /C " &
"dir /b /a-d "&strip$(path.client1)&
" >" & strip$(listf.f),
"", "", "", "") |path.client1 from listd.f
|list of files within the folder
|move listf.f to server using client2server()
Reply With Quote
  #10  
Old 9th October 2019, 20:41
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,107
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
Quote:
I came across these functions. But I need functions which can handle local folder the way dir.open() is doing with server, without opening an dialog box as I need these functions for automation.

We have files in local folder.
Currently user selects Sales Quotation from overview session, click on Attachment button on the session, answers "File Linking" on the following question, then session dmdoc4540m002 appears.User than fills the details and browse file from the local folder and upload it.

We need to automate it now and run it through job.
The issues I am facing is
How to get file from local folder path (eg.C:\upload\<Quotation No>\) and use it in stpapi.put.field( "dmdoc4540m002", "filename", "file_from_local_folder")?As I am not getting any function like dir.open() for local folder
Refer to the latest Programmer's Manual -

Quote:
seq.open.dialog.local()
Syntax:
#include <bic_desktop>

function long seq.open.dialog.local (boolean mselect, string defaultname, string directory, string filter, ref string filename)

Description

Deprecated. This shows the Windows file-open dialog, to allow the user to select one or more local files.


Arguments
boolean mselect When true, multiple select is allowed by the user else only one file can be selected by the user.

string defaultname The default filename shown in the file-open dialog.

string directory The startup directory for this dialog. In case of an empty string the "My Documents" directory will be the default. This parameter may include the string ${BSE_TMP} which indicates the ${BSE}\tmp directory in case of Baan Windows or Windows temp directory in case of WebUI.

string filter This argument specifies all possible file extensions for the file. The string must contain pairs of strings that are separated by a "|" character. The first string in each pair is a filter name (for example: "Text Files"). The second string must be a filter patern (for example: "*.txt"). Multiple filter patters can be specified by separating the filter patterns with a semicolon. Example: "All Files(*.*)|*.*|Text Files(*.txt) Word documents(*.doc)|*.txt;*.doc"

ref string filename Output argument which will contain the full path of the file selected by the user. In case mselect is true possible other selected file names can be retrieved using function seq.open.dialog.next()


Return values
>0 Number of files selected by the user.
0 File open dialog canceled by the user.
-1 Error occurred

Context
This function is implemented in the 4GL Engine and can be used in all script types.

This function is marked as 'untrusted' and can therefore only be used in trusted objects. More about trusted and not trusted objects can be found in the section about managed execution..

Notes
This function is not supported in LN UI. See the Implementing LN UI support for more information.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
  #11  
Old 9th October 2019, 20:47
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,107
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
Also refer to these threads for the select.file() usage -

http://www.baanboard.com/baanboard/s...ht=select.file

How can I copy a file from the server to a certain path
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
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 On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dir.open() monica1 Tools Development 1 28th April 2005 19:51
dir.open return zero..!! SriksAdi Tools Development 2 12th October 2004 09:04
create.local.directory Ilansu Tools Development 4 12th February 2003 11:31


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


©2001-2018 - Baanboard.com - Baanforums.com