[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

SalesFormLetter.exportToFile() what is wrong ?

Marcin Krzyzanowski

11/14/2005 10:47:00 AM

Hi,

I have a problem with SalesFormLetter.exportToFile() method.

I have SalesFormLetter_Foo extends SalesFormLetter, and override
exportToFile() where I have:

fileName param is set.

if (WinAPI::fileExists(fileName))
{
// FILE EXISTS, DONT KNOW WHY IF IT DOESN'T YET
}

try
{
outputFile = new AsciiIO(fileName, 'W');
if (! outputFile)
{
throw error("THIS ERROR IS NEVER THROW HERE"));
}
}
catch (Exception::Deadlock)
{
retry;
}

outputFile.write("TEXT"); // NO ERROR STILL here, outputFile.status
is IO_Status::OK

return;

Finally no error is throw but no file is created anyway. The biggest
question for me is why fileExists() show that fileName exists but it
don't, finally no file is created.

The same code called from any other plase work fine.

Does anybody have any clue about this ?
5 Answers

Marcin Krzyzanowski

11/14/2005 10:57:00 AM

0

Marcin Krzyzanowski napisa3(a):
> Hi,
>
> I have a problem with SalesFormLetter.exportToFile() method.

I forgot mention that exportToFile() is called from
SalesFormLetter.createJournal()

Marcin Krzyzanowski

11/14/2005 11:56:00 AM

0

Marcin Krzyzanowski napisa3(a):
> Marcin Krzyzanowski napisa3(a):
>> Hi,
>>
>> I have a problem with SalesFormLetter.exportToFile() method.
>
> I forgot mention that exportToFile() is called from
> SalesFormLetter.createJournal()
>

Sorry about this self responses ;)

I even know what is the problem. Problem is that this file is created on
machine where AOS is running, but now I'm not sure why it work this
way, and how to force it to use local resources instead from AOS machine ?

3-tier thin client.


Mike Frank

11/14/2005 3:28:00 PM

0

You have to force the method to run on client. For a static method you can do this with the client
keyword. An instance method however runs always where the class runs. So you will have to create a
new class or a static method.

An example for this are the methods WinAPI::fileExistsClient(Server).

Mike

Marcin Krzyzanowski

11/14/2005 3:39:00 PM

0

Mike Frank napisa3(a):
> You have to force the method to run on client. For a static method you
> can do this with the client keyword. An instance method however runs
> always where the class runs. So you will have to create a new class or a
> static method.
>
> An example for this are the methods WinAPI::fileExistsClient(Server).

Thanks, this is how I did it finally, however, I couldn't find where it
is set that it should run on server, I changed MenuItem to run from
client for testing, AOSRunMode::Client but it was still on server.

Anyway:

client static Object newOnClient()
{
return new MyClass();
}

work just fine ;)

Mike Frank

11/17/2005 10:45:00 AM

0

> Thanks, this is how I did it finally, however, I couldn't find where it
> is set that it should run on server, I changed MenuItem to run from
> client for testing, AOSRunMode::Client but it was still on server.

For a class you can set this in the properties. This affects all object methods. Static methods can
be changed with the modifier.

Mike