Filesearch from Navision

PegasusPegasus Member Posts: 4
edited 2011-09-08 in Navision Financials
Hi
I am looking for a way to open the MS-Filesearch-Dialog out of a form, get a filename, and copy the name into a Table.

The reason is the following:
I export a debitor-adress to a word-dot file from out financials.
It works fine. I have a table where the adress of the documents and the name can put in.
But till now he have to type the adresses and the document name by hand and this is not very confortable.
My Idea is to give the user an open-file dialog where he can browse through his drives and mark the file he want to take into this list.
Does anyone has an idea?

Thomas Blang

Comments

  • Borislav_PopovBorislav_Popov Member Posts: 14
    Right Luc : but u can use File table too : and create a form for it and the functionality needed to browse through the dirs setting ranges on the path field of this table. But the way you mentioned is better.
  • John_TegelaarJohn_Tegelaar Member Posts: 159
    Well, you can use the 'standard' Windows Open File dialog too, from any form (not only the requestform for a report).

    Create a TextBox, set LookUp = Yes (gives a permanent lookup arrow), and set as source expression the variable FileName (text, 250).

    Furthermore, create a variable BrowseDialog (OCX, Microsoft Common Dialog, COMDLG32.OCX)

    In the OnLookUp trigger you put the following code:

    BrowseDialog.DialogTitle := 'Select your file';
    BrowseDialog.InitDir := 'C:\';
    BrowseDialog.Filter := 'Text files|*.txt|All files|,*.*';
    BrowseDialog.ShowOpen;
    FileName := BrowseDialog.FileName;

    Now when you user clicks the lookup arrow, the familiar Windows filedialog pops up and you get the FileName back. Empty means the user cancelled the action.

    Note: You need to have a COMDLG32.OCX with Developers License to create the control, not to use it. A developers license common dialog is included with i.e. Visual Basic, Visual C++ etc.

    John
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Look up the message titled "File Dialog in Dataports" from 01-03-2000. There you will find the solution.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • PegasusPegasus Member Posts: 4
    Thank you.

    It works fine but there is another problem too. When I export the objects and use it on an other machine I became an error-massage.

    I have to put the COMDLG32.OCX onto this machine and have to register this OCX in Financials. Then it will work.

    On the other side there is a Browse-dialog in the custom control menu, but I cannot open it to see how they have done it.

    The other think is: Is it legal to give this OCX to our customers?

    Any Ideas?

    Thomas Blang
  • John_TegelaarJohn_Tegelaar Member Posts: 159
    Thomas,

    Not 100% sure (no system around without VB installed at the moment), but I believe it's sufficient to register in Navision the COMDLG32.OCX which is standard part of Windows, to use the control.

    Might be a matter of version though, to get it working (you need Common Dialog 6.0). As the common dialog is a standard part of Windows, I don't think there's an objection against distributing it for this purpose; the alternative would be that you user is updating Windows by free downloads from the Microsoft site.

    The browse dialog you get in the Customs Tools window, or the Request Form for that matter, is also the standard Windows common dialog, only difference is that NF is calling it directly.

    John
  • PegasusPegasus Member Posts: 4
    Hello John

    And how is it in a network-installation? Have I to update every Workstation?

    Thomas Blang
  • John_TegelaarJohn_Tegelaar Member Posts: 159
    Thomas,

    That's quite obvious: Yes.

    But then again it's probably better to tell the system administrator to do his job properly, and get him to update the workstations to a more recent Windows version.

    John
  • jpjp Member Posts: 47
    John:

    System Administrator???

    Updated Windows versions???

    Can I come work in your world? <img border="0" title="" alt="" src="images/smiles/icon_wink.gif" />

    -jp
    -jp
  • John_TegelaarJohn_Tegelaar Member Posts: 159
    JP: LOL

    But if it's that bad in your world, your company has a good opportunity for generating extra business: Offer the customer to work as their system administrator <img border="0" title="" alt="" src="images/smiles/icon_biggrin.gif" />

    John
  • Tarek_DemiatiTarek_Demiati Member Posts: 112
    I once wrote a few lines of code to make life easier for a sys admin to update and register a set of OCXes in the Windows registries

    I don't have the code handy but it's rather straight forward :

    1/ Declare a global of type Record, Record Name = OLE Control

    2/ set a filter on the name of the OLE control you want to register

    and then you've got to do something like

    IF NOT recOleControl.FIND('-') THEN
    SHELL('regsvr32 c:\windows\system\yourocx.ocx');

    tarek_demiati@ureach.com


    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by John Tegelaar:
    Thomas,

    That's quite obvious: Yes.

    But then again it's probably better to tell the system administrator to do his job properly, and get him to update the workstations to a more recent Windows version.

    John
    <HR></BLOCKQUOTE>
  • mabl4367mabl4367 Member Posts: 143
    Hi all!

    I recently created a processing report that also saves som data in a text file.

    To alow the user to specify the location and name of the file that the report creates I did the folowing:

    1. Added a text box to the reports requestform.
    2. Sett the "AssistEdit" property of the text box to "Yes"
    3. In the "OnAssistEdit" trigger of the text box I added a local variable of type Codeunit, subtype "Common Dialog Management"
    4. Added a call to this codeunits function "OpenFile"
    5. Saved the returnvalue of the function in a global variable of type Text.
    6. Used the global variable as SourceExpression for the text box.

    The codeunit uses the same OCX as described in prevoius posts. Since the codeunit is already compiled I can use this methode even though I don't have a developers license. Also I dont have to install VB.
Sign In or Register to comment.