DOWNLOAD txt in RTC

kirkostaskirkostas Member Posts: 127
I have a batch report to export a text file.
I was able to run it through RTC client because I use CDO 419.
New request need to stop prompt common dialog windows and read from a setup table the destination location of the exported file.

The code before was:
DOWNLOAD(FileName, '', SetupTbl.Path, '', FileName2);
and I thought I have to change the Setuptbl.Path only by entering the Magic Path so the new code is
DOWNLOAD(FileName, '', '<TEMP>', '', FileName2);

The problem is the file is not saved to the specific path. I don't have any error message at all. I remove the Magic Path the prompt ask me where to save and it work. I put on the magic path and the file does not work.
Filename is the full path of the file created on the RTC server.
Filename2 is the full path of the destination file I want to create.

Can anyone help?
kirkostas

Comments

  • SPost29SPost29 Member Posts: 148
    I have noticed sometimes in NAV, especially in parameters, you can't use literals directly you have to use a variable.
    notice here in the NAV code from COD 419 it assigns the MagicPath first to a variable and then uses the variable as the parameter
    DownloadTempFile(ServerFileName : Text[1024]) : Text[1024]
    IF NOT ISSERVICETIER THEN
      EXIT(ServerFileName);
    
    FileName := ServerFileName;
    Path := Magicpath;
    DOWNLOAD(ServerFileName,'',Path,Text009,FileName);
    EXIT(FileName);
    
    Magicpath() : Text[1024]
    EXIT('<TEMP>');   // MAGIC PATH makes sure we don't get a prompt
    


    hope this helps
    Steve
  • kirkostaskirkostas Member Posts: 127
    Yes, I already did that with no success. I even used the Text009 of the CDO 419 just to be sure. It doesn't save the file, but if I remove the magic path it prompt me and I save the file. Why? Is it a bug of the magic path?
    kirkostas
  • kirkostaskirkostas Member Posts: 127
    Nice you working with Windows Script Host, but I have noticed you say in the example
    If you want to export the file as in Classic Client like with common Dialogue Management, follow the below steps..

    I use the internal function DOWNLOAD and I don't have any problem with prompt, the problem is the non prompt way. From the moment I used the magic path the file stop copy itself from server to client. If I use the prompt it worked. If you know there is a bug in DOWNLOAD function of Navision ok I will use wsHost but I will report this to Microsoft.
    kirkostas
  • kirkostaskirkostas Member Posts: 127
    I just realize when I call the internal system function DOWNLOAD with MagicPath the variable Filename2 change location. That's why it cannot be copied. So I must open an InStream variable and DOWNLOADFROMSTREAM from the MagicPath path and copy it by using 'Microsoft Scripting Runtime'.FileSystemObject Automation.

    Thanks Mohana for the idea.
    kirkostas
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    kirkostas wrote:
    I just realize when I call the internal system function DOWNLOAD with MagicPath the variable Filename2 change location. That's why it cannot be copied. So I must open an InStream variable and DOWNLOADFROMSTREAM from the MagicPath path and copy it by using 'Microsoft Scripting Runtime'.FileSystemObject Automation.

    Thanks Mohana for the idea.

    welcome :D
Sign In or Register to comment.