Giovanni27
12th March 2010, 18:27
Hi !!

I'm looking for a statement, because i need to find a file on windows server to know if it exist or no, then i need to put a label (yes) in a layout in baan.

Sorry.. my english is so bad XD

Can someone help me !!!!

Giovanni27
12th March 2010, 18:58
I found a statemet (server2client) but i don't know if i can use it to look for a file (only i just want to know if the file exist or not on the server)

steveauckly
12th March 2010, 19:43
You could try:

file.id = seq.open("filepath\filename","r")
if file.id = -2 then
|file does not exist
else
seq.close(file.id)
endif

Giovanni27
12th March 2010, 19:59
Hi steveauckly !!!

Thanks for the answer...

the biggest problem is that i'm a noob in baan

More inf

---- The baan server is 'x'
---- and the other server is windows.

I'm working on server 'x' and i want to know if a file on windows server exist.
i don't know how to do it.

I just want a yes or not if the file exist on windows server.


*** Sorry but my english is so bad :S

bdittmar
12th March 2010, 22:09
Hi steveauckly !!!

Thanks for the answer...

the biggest problem is that i'm a noob in baan

More inf

---- The baan server is 'x'
---- and the other server is windows.

I'm working on server 'x' and i want to know if a file on windows server exist.
i don't know how to do it.

I just want a yes or not if the file exist on windows server.


*** Sorry but my english is so bad :S


Hello,

use seq.open.local()
Here's the reference:

BaanERP Programmers Guide


seq.open.local()

--------------------------------------------------------------------------------

Syntax
long seq.open.local( string filename, string mode(2), [long remove.after.use] )
Description
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. The function supports long file names.

Arguments
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.

mode
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.

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


Note
You cannot use seq.*() 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().

Return values
>=0 Success. File pointer is returned.

<0 Error. File could not be opened.

Regards

Giovanni27
20th March 2010, 06:29
heey steveauckly and bdittmar:

thanks a lot...

i tried it and it doesn't have compilation errors but
when it runs the program it ever returns (file.id = 2), the problem is that the file already exist


this is the code.

function set.buscar()
{
select tiban001.item, tiban001.stat
from tiban001 for update
where tiban001.item = “AAA001”
selectdo
item_w = “AAA001” | strip$(tiban001.item)
item_w = item_w&”.PLT”
file.id = seq.open(\\myservde\inf\user\item_w,”r”)
if file.id >= 1 then
tiban001.stat = tcyesno.yes
seq.close(file.id)
else
file.id = seq.open(\\myservde\inf\user\second\item_w,”r”)
if file.id >= 1 then
tiban001.stat = tcyesno.yes
else
tiban001.stat = tcyesno.no
seq.close(file.id)
endif
endif
endselect
}

it returns (file.id = -2)

any idea about the problem?
I try to find the file on a windows server

sushil
20th March 2010, 18:32
Try Using Local Path instead of network path

file.id = seq.open("C:\filepath\filename.txt",”r”)

sushil
20th March 2010, 18:38
i think you are trying to use variable in file name. then try this
file.id=seq.open("c:\filepath\" & variable,"r")

Giovanni27
20th March 2010, 19:13
i think you are trying to use variable in file name. then try this
file.id=seq.open("c:\filepath\" & variable,"r")


Hi !! Sushil

i'll try it, but after 2 days xD because i work monday to friday, and today is saturday in my country xD

thanks a lot =D

a question.. it doesn't matter if the server where i try to find the file is a windows server?

greetings!!

sushil
22nd March 2010, 05:07
a question.. it doesn't matter if the server where i try to find the file is a windows server?
Have you ever tried to take Oracle incremental backup using RMAN in Network Drive ??

May be that answers the Q.

Giovanni27
22nd March 2010, 16:24
i have tried
file.id = seq.open(\\myservde\inf\user\second\"&item_w,”r”)
but it doesn't returns the file pointer.

when i'm debuggin the session the value of file.id always is -2
but the file exist :S

any idea why the file.id always is -2

(the file exist but id doesn't return a value file.id >= 1 :S

function set.buscar()
{
select tiban001.item, tiban001.stat
from tiban001 for update
where tiban001.item = “AAA001”
selectdo
item_w = strip$(tiban001.item)
item_w = item_w&”.PLT”
file.id = seq.open(\\myservde\inf\user\"&item_w,”r”)
if file.id >= 1 then
tiban001.stat = tcyesno.yes
seq.close(file.id)
else
file.id = seq.open(\\myservde\inf\user\second\"&item_w,”r”)
if file.id >= 1 then
tiban001.stat = tcyesno.yes
else
tiban001.stat = tcyesno.no
seq.close(file.id)
endif
endif
endselect
}

Giovanni27
22nd March 2010, 16:26
i'm a beginner on baan xD

bdittmar
27th March 2010, 17:03
Hello Giovanni,

seq.open() is used for files on the BaaN-Application-Server !

seq.open.local() is used for files on the client PC accessing BaaN.

Most UNC (\\server\....) is a problem. Better use drive letters.

Are you able / allowed to create a samba share between your BaaN Server and Windows Server ?

In this case seq.open() maybe work on the samba-dir.

A workaround may be:

create a scheduled batch in your server dir:

FOR %%b IN (*.*) DO @echo %%b>>dirinfo.txt
(Creates a file with all filenames in the directory line by line)

FTP this file to your BaaN box.
After FTP delete the file on WIN Server !

Read the file from BaaN Box with seq.open()


Regards

oledba
3rd April 2010, 13:07
listen to what is written above