Batchjob not working with WinApi::findFirstFile?

burdee64
Member Posts: 20
Hello,
I've written an XML import function. It is working fine if the program is initiated interactively from the menu.
However when I start the same program as a batch it doesnt work.
What's the program do:
private int ScanForFile(FilePath _directory)
{
str filename = "*.xml";
container con;
int handle = 0;
int ret = 0;
str naam;
boolean created;
;
con = WinApi::findFirstFile(_directory + filename);
if (con)
{
handle = conPeek(con, 1);
// first filename:
naam = conPeek(con, 2);
while (naam)
{
if (naam != "." && naam != "..")
{
// process this file
created = this.ConvertXML2SalesOrder(_directory + naam);
}
.........
So it scan for XML-files in a directory, using WinApi::findFirstFile
What did I test:
1) Setting up some XML-files in c:\temp\.
Running the program on my PC interactively.
Directory = C:\temp\
result: running correctly
2) Setting up the same files in the same directory.
Starting batch-operation on that same Axapta session on my PC.
Starting the program as a batch on another PC.
Program does run as batch on my PC, but fails to find the files.
3) Same procedure as 2) but do a debug on my PC as well...
(Debugging the batch-run of this program)
All variables are correctly filled (ie. _directory and filename) but the container con is filled with empty data. => handle = -1 and naam = "" (empty).
Why???
Can somebody help me out?
Axapta 3.0 SP3
I've written an XML import function. It is working fine if the program is initiated interactively from the menu.
However when I start the same program as a batch it doesnt work.
What's the program do:
private int ScanForFile(FilePath _directory)
{
str filename = "*.xml";
container con;
int handle = 0;
int ret = 0;
str naam;
boolean created;
;
con = WinApi::findFirstFile(_directory + filename);
if (con)
{
handle = conPeek(con, 1);
// first filename:
naam = conPeek(con, 2);
while (naam)
{
if (naam != "." && naam != "..")
{
// process this file
created = this.ConvertXML2SalesOrder(_directory + naam);
}
.........
So it scan for XML-files in a directory, using WinApi::findFirstFile
What did I test:
1) Setting up some XML-files in c:\temp\.
Running the program on my PC interactively.
Directory = C:\temp\
result: running correctly
2) Setting up the same files in the same directory.
Starting batch-operation on that same Axapta session on my PC.
Starting the program as a batch on another PC.
Program does run as batch on my PC, but fails to find the files.
3) Same procedure as 2) but do a debug on my PC as well...
(Debugging the batch-run of this program)
All variables are correctly filled (ie. _directory and filename) but the container con is filled with empty data. => handle = -1 and naam = "" (empty).
Why???
Can somebody help me out?
Axapta 3.0 SP3
Bert van Dijk
Rotor BV
Rotor BV
0
Answers
-
I would guess, that it has something to do with the place the batch job is executed.
It is possible, that it is looking for your files on the server, while you have them on your local PC.
At least that is what happened to me a couple of times.
Setting the RunOn property to Client solved it.
Hope it helps you too.Vanya Kashperuk,
My blog - http://kashperuk.blogspot.com
MorphX IT in Russian - http://www.lulu.com/content/723888
Inside Dynamics AX 4.0 in Russian - http://www.ozon.ru/context/detail/id/37145820 -
Ivan,
You got it right!
It's sometimes so logically that one is missing the obvious.
Thanks alot.
BertBert van Dijk
Rotor BV0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions