Tricky Function for ngdesktopfile - any ideas?

Forum to discuss the new web client version of Servoy.

Tricky Function for ngdesktopfile - any ideas?

Postby vik.lamp.vl » Tue Aug 01, 2023 9:44 am

Hey guys,

i have feature request from a client, which is a bit tricky to implement. So maybe you guys have a idea.

Scenario:

The customer uses a TI solution from us (Servoy 23.6, NGDesktop, Windows envrioment). He works with alot of Word-Files which named for example 63_8010_200_01_XX_XY.docx
In the solution he needs to select this file, and we save the location of the file. We use
Code: Select all
plugins.ngdesktopfile.showOpenDialog()
which works perfectly.

Now the tricky part. The customer got many of those files. So when the openDialog opens, he uses the windows search bar with the prompt
Code: Select all
63*8010*200*01*
and then selects the right file.

Question. Can our solution somehow interact with the windows-search textfield of the openDialog window?
Best outcome would be: showOpenDialog() maybe with a parameter-object {searchParam: "63*8010*200*01*"}. So when the windows-dialog pops up, the search-field is already filled.

Maybe one of you guys have a idea.

Greetings and have a great day!
-Vik
vik.lamp.vl
 
Posts: 25
Joined: Wed May 26, 2021 3:37 pm
Location: Germany

Re: Tricky Function for ngdesktopfile - any ideas?

Postby robert.edelmann » Tue Aug 01, 2023 11:36 am

Have you tried to supply an option-object to the function? We do something like this for saving files:
Code: Select all
var homePath = plugins.ngdesktopfile.homeDir() + java.io.File.separator + fileName;
var fileOptions = {
   title: 'Ausgabedatei',
   defaultPath: homePath,
   buttonLabel: 'Ok',
   filters: [{name: 'Excel-Datei', extensions: ['xlsx']}]};
filePath = plugins.ngdesktopfile.showSaveDialogSync(fileOptions)

The object is explained here: https://www.electronjs.org/docs/latest/api/dialog#dialogshowsavedialogsyncbrowserwindow-options,
defaultPath string (optional) - Absolute directory path, absolute file path, or file name to use by default.

looks like it could fit your purpose.
mit freundlichen Grüßen
Robert Stefan Edelmann
User avatar
robert.edelmann
 
Posts: 95
Joined: Wed Aug 14, 2013 6:12 pm

Re: Tricky Function for ngdesktopfile - any ideas?

Postby mboegem » Tue Aug 01, 2023 12:04 pm

Hi Vik,

like Robert pointed out there is documentation available on the options.
In case of the opendialog this is the link (mentioned in the function tooltip in Servoy): https://www.electronjs.org/docs/latest/ ... ow-options
As far as I can see there is no way to pass in a filter on filenames, just for named (group of) extensions.

I think so far for the easy solution.
Looking at the available functions in the plugin, you can create your own file open dialog by using the listDir function.
For each name that is returned, you can then ask for its properties using the getFileStats function, this contains information about whether its a file or a folder.
You can already filter down the list of names as you like from the result of the listDir function.
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Tricky Function for ngdesktopfile - any ideas?

Postby sbutler » Wed Aug 02, 2023 2:01 am

I'd do your own file management. So have a settings area in the app to let the customer pick the root folder for document management. Say they pick "c:\docs"
Then in the area where they manage the files, have them enter in the filename in the app, and mimic your own file save dialog system, then make ng desktop calls to write it to disk. This way you can do a folder system and when they enter 63_8010_200_01_XX_XY.docx for the file name, you save it to "c:\docs\63_8010_200_01\63_8010_200_01_XX_XY.docx". Then when they want to open a file, you can let them pick from files in ""c:\docs\63_8010_200_01\". Or even automate that and pull the list of files and show it in a custom pick list screen in your app. That way the file management feels more integrated.
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Tricky Function for ngdesktopfile - any ideas?

Postby vik.lamp.vl » Tue Aug 08, 2023 11:11 am

Hi guys, thanks for the input!
I guess we have to do or own "selectDialog".

Im gonna put this request on the backburner for now. The customer needs to do one more mouse-click and use the windows-search field for now.

When i have time for that, i´ll get you updated how we did the workaround for this!

Greetings and have a nice week :)
Vik
vik.lamp.vl
 
Posts: 25
Joined: Wed May 26, 2021 3:37 pm
Location: Germany


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 23 guests