formatted nav patterns
This commit is contained in:
parent
38a19d75d8
commit
2fad891a77
59 changed files with 1403 additions and 1970 deletions
|
|
@ -23,19 +23,23 @@ In the following, both the historical and the recommended ways of silently trans
|
|||
|
||||
The legacy API for file transfers \[2\]:
|
||||
|
||||
```al
|
||||
\[Ok :=\] UPLOAD(DialogTitle, FromFolder, FromFilter, FromFile, ToFile)
|
||||
|
||||
\[Ok :=\] DOWNLOAD(FromFile, DialogTitle, ToFolder, ToFilter, ToFile)
|
||||
```
|
||||
|
||||
As you can see, this historical API leaves no place for turning off the functionality for showing a dialog. Historically, NAV offered a remedy to this, namely by using the "Magicpath" string, which is the constant '<TEMP\>'. Under this condition, the way to invoke silent file upload or download becomes:
|
||||
|
||||
```al
|
||||
\[Ok :=\] UPLOAD(DialogTitle, Magicpath, FromFilter, FromFile, ToFile)
|
||||
|
||||
\[Ok :=\] DOWNLOAD(FromFile, DialogTitle, Magicpath, ToFilter, ToFile)
|
||||
```
|
||||
|
||||
This remedy introduced an issue: If we use "Magicpath" instead of **FromFolder** and **ToFolder** specifications, then where do we upload from and where do we download to? The answer is that they are uploaded to and downloaded from the NAV server's temporary folder. The path to the temporary file can be obtained when this file is created, by using the following function in **File Management: <tempFileName\> := ServerTempFileName(<fileExtension\>)**.
|
||||
|
||||
The new API for file transfers in the **File Management **codeunit:
|
||||
The new API for file transfers in the **File Management** codeunit:
|
||||
|
||||
\[Text :=\] UploadFileSilent(ClientFilePath)
|
||||
|
||||
|
|
@ -59,21 +63,26 @@ The production manager wants to have the file in a predefined location on his ha
|
|||
|
||||
The NAV developer has written a module to query the CRONUS database and to export the product list in the pre-described XML format required by the web shop. He saves the data in a temporary server file created with this code:
|
||||
|
||||
```al
|
||||
ServerFileName := FileManagement.ServerTempFileName('xml');
|
||||
```
|
||||
|
||||
When the file has been populated with the latest product data, the NAV developer uses the following call to download the file from the temporary location on the server to the predefined location on the client:
|
||||
|
||||
```al
|
||||
FileManagement.DownloadToFile(ServerFileName,ClientFileName);
|
||||
```
|
||||
|
||||
The call to **DownloadToFile** is part of the **File Management **codeunit, and it embeds the silent download offered by **DownloadTempFile**:
|
||||
The call to **DownloadToFile** is part of the **File Management** codeunit, and it embeds the silent download offered by **DownloadTempFile**:
|
||||
|
||||
```al
|
||||
PROCEDURE DownloadToFile@13(ServerFileName@1002 : Text;ClientFileName@1000 : Text);
|
||||
|
||||
VAR TempClientFileName@1001 : Text;
|
||||
|
||||
BEGIN ValidateFileNames(ServerFileName,ClientFileName); TempClientFileName := DownloadTempFile(ServerFileName); MoveFile(TempClientFileName,ClientFileName);
|
||||
|
||||
VAR
|
||||
TempClientFileName@1001 : Text;
|
||||
BEGIN
|
||||
ValidateFileNames(ServerFileName,ClientFileName); TempClientFileName := DownloadTempFile(ServerFileName); MoveFile(TempClientFileName,ClientFileName);
|
||||
END
|
||||
```
|
||||
|
||||
## Consequences
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue