How to selec a folder in WEBCLIENT in Navision.

kovaidon
Member Posts: 55
Hi all,
I case of RTC , we have function in Codeunit -419(File Management) "SelectFolderDialog", Which is useful and can be used to select folder.
But in case of WEBCLIENT, this SELCTFOLDERDIALOG is not working.is there is any alternative.?
Please experts expecting your valuable suggestion
I case of RTC , we have function in Codeunit -419(File Management) "SelectFolderDialog", Which is useful and can be used to select folder.
But in case of WEBCLIENT, this SELCTFOLDERDIALOG is not working.is there is any alternative.?
Please experts expecting your valuable suggestion
0
Best Answer
-
Hello @kovaidon,
Looks like the DotNet Folder Dialog doesn't work, so I did a workaround borrowing some functions from the codeunit 419 of BC.OBJECT Codeunit 50997 Folder Mgt. { OBJECT-PROPERTIES { Date=15-10-18; Time=23:43:21; Modified=Yes; Version List=DIR; } PROPERTIES { OnRun=BEGIN END; } CODE { VAR ServerFileHelper@1000000003 : DotNet "'mscorlib'.System.IO.File"; ServerDirectoryHelper@1000000002 : DotNet "'mscorlib'.System.IO.Directory"; PathHelper@1000000004 : DotNet "'mscorlib'.System.IO.Path"; PROCEDURE GetServerDirectoryListInclSubDirs@1000000002(VAR TempNameValueBuffer@1000 : TEMPORARY Record 823;DirectoryPath@1001 : Text); BEGIN TempNameValueBuffer.RESET; TempNameValueBuffer.DELETEALL; GetServerDirectoryListInclSubDirsInner(TempNameValueBuffer,DirectoryPath); END; LOCAL PROCEDURE GetServerDirectoryListInclSubDirsInner@1000000001(VAR NameValueBuffer@1000 : Record 823;DirectoryPath@1001 : Text); VAR ArrayHelper@1002 : DotNet "'mscorlib'.System.Array"; FileSystemEntry@1004 : Text; Index@1003 : Integer; LastId@1005 : Integer; BEGIN ArrayHelper := ServerDirectoryHelper.GetDirectories(DirectoryPath); FOR Index := 1 TO ArrayHelper.GetLength(0) DO BEGIN IF NameValueBuffer.FINDLAST THEN LastId := NameValueBuffer.ID; EVALUATE(FileSystemEntry,ArrayHelper.GetValue(Index - 1)); IF ServerDirectoryExists(FileSystemEntry) THEN NameValueBuffer.ID := LastId + 1; NameValueBuffer.Name := COPYSTR(FileSystemEntry,1,250); NameValueBuffer.Value := COPYSTR(GetFileNameWithoutExtension(NameValueBuffer.Name),1,250); NameValueBuffer.INSERT; GetServerDirectoryListInclSubDirsInner(NameValueBuffer,FileSystemEntry) END; END; PROCEDURE ServerDirectoryExists@48(DirectoryPath@1000 : Text) : Boolean; BEGIN EXIT(ServerDirectoryHelper.Exists(DirectoryPath)); END; PROCEDURE GetFileNameWithoutExtension@35(FilePath@1000 : Text) : Text; BEGIN EXIT(PathHelper.GetFileNameWithoutExtension(FilePath)); END; BEGIN END. } }
You can call the function like this:FolderMgt.GetServerDirectoryListInclSubDirs(Buffer, 'C:\NAV09R2(32794)'); PAGE.RUN(823, Buffer);
There FolderMgt and Buffer (temporary) are:Name DataType Subtype FolderMgt Codeunit Folder Mgt. Buffer Record Name/Value Buffer
You need to provide a path to the function, an improve would be first show the logical units in the server an after choosing one show the folders.
Also you need to elaborate the call to the PAGE 823 to get the folder chosen.
Regards.1
Answers
-
Mr. ftornero! Could you please help me out in this?
0 -
Hi sir,
it is for Updating Setup -Path Selection in Web Client environment.
0 -
Well, the problem with the "SelectFolderDialog" function in the codeunit 419 is that uses the DotNet vars to run on Client, and in the Web client you can not use this vars, but you can use DotNet vars that run on Sever.
So, if the folder to select is accesible form the server you can borrow that function ,copy to one of your codeunits and change the DotNet vars to run on Server.
Regards.0 -
Hi sir,
I have even tried with by setting Properties of RunOnClient- No(Which Run in Server). but it is not working, since the DOTNET Variable defined are Windows based .
Do we have option other than developing Java Script based Conteol addins for this?0 -
You can use DotNET vars in the server.
Could you tell what version of NAV are you using ?0 -
Hi,
Iam using NAv2017 Version.
0 -
Hello @BlackTiger ,
I previously said that the server have to have access to the folder (a shared one).
To @kovaidon, I going to do some test0 -
Well, this the error when calling the "SelectFolderDialog" on the server with the web client
I'm going to try other options and keep you posted.
Regards.0 -
Hi sir,
Exactly same error.
Looking forward for your valuble input .
0 -
Hello @kovaidon,
Looks like the DotNet Folder Dialog doesn't work, so I did a workaround borrowing some functions from the codeunit 419 of BC.OBJECT Codeunit 50997 Folder Mgt. { OBJECT-PROPERTIES { Date=15-10-18; Time=23:43:21; Modified=Yes; Version List=DIR; } PROPERTIES { OnRun=BEGIN END; } CODE { VAR ServerFileHelper@1000000003 : DotNet "'mscorlib'.System.IO.File"; ServerDirectoryHelper@1000000002 : DotNet "'mscorlib'.System.IO.Directory"; PathHelper@1000000004 : DotNet "'mscorlib'.System.IO.Path"; PROCEDURE GetServerDirectoryListInclSubDirs@1000000002(VAR TempNameValueBuffer@1000 : TEMPORARY Record 823;DirectoryPath@1001 : Text); BEGIN TempNameValueBuffer.RESET; TempNameValueBuffer.DELETEALL; GetServerDirectoryListInclSubDirsInner(TempNameValueBuffer,DirectoryPath); END; LOCAL PROCEDURE GetServerDirectoryListInclSubDirsInner@1000000001(VAR NameValueBuffer@1000 : Record 823;DirectoryPath@1001 : Text); VAR ArrayHelper@1002 : DotNet "'mscorlib'.System.Array"; FileSystemEntry@1004 : Text; Index@1003 : Integer; LastId@1005 : Integer; BEGIN ArrayHelper := ServerDirectoryHelper.GetDirectories(DirectoryPath); FOR Index := 1 TO ArrayHelper.GetLength(0) DO BEGIN IF NameValueBuffer.FINDLAST THEN LastId := NameValueBuffer.ID; EVALUATE(FileSystemEntry,ArrayHelper.GetValue(Index - 1)); IF ServerDirectoryExists(FileSystemEntry) THEN NameValueBuffer.ID := LastId + 1; NameValueBuffer.Name := COPYSTR(FileSystemEntry,1,250); NameValueBuffer.Value := COPYSTR(GetFileNameWithoutExtension(NameValueBuffer.Name),1,250); NameValueBuffer.INSERT; GetServerDirectoryListInclSubDirsInner(NameValueBuffer,FileSystemEntry) END; END; PROCEDURE ServerDirectoryExists@48(DirectoryPath@1000 : Text) : Boolean; BEGIN EXIT(ServerDirectoryHelper.Exists(DirectoryPath)); END; PROCEDURE GetFileNameWithoutExtension@35(FilePath@1000 : Text) : Text; BEGIN EXIT(PathHelper.GetFileNameWithoutExtension(FilePath)); END; BEGIN END. } }
You can call the function like this:FolderMgt.GetServerDirectoryListInclSubDirs(Buffer, 'C:\NAV09R2(32794)'); PAGE.RUN(823, Buffer);
There FolderMgt and Buffer (temporary) are:Name DataType Subtype FolderMgt Codeunit Folder Mgt. Buffer Record Name/Value Buffer
You need to provide a path to the function, an improve would be first show the logical units in the server an after choosing one show the folders.
Also you need to elaborate the call to the PAGE 823 to get the folder chosen.
Regards.1 -
Sir Fernando,
It works like Charms!. Please accept my Heartiest Thanks for your wonderful and Awesome Logic in bring out the output within limitations .
Once again Thank you very much ! Hatsoff to you Sir!!!!0 -
0
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