[solved]Custom Dataport Request Form

ta5ta5 Member Posts: 1,164
edited 2008-11-18 in Navision Financials
Hello

We have a problem with a custom dataport request form, Navision 2.6 native.
This works ok
http://www.mibuso.com/howtoinfo.asp?FileID=4&Type=howto

When set the direction to export, a problem arises:
Browsing for export-file, we get the error "file xyz.txt does not exist", altough before currdataport.import was set to false. Imho the error message should not fire because the file does not exist has to be created by the dataport later. Importing a file works without a problem.

Any help would be appreciated.
Thomas

Comments

  • garakgarak Member Posts: 3,263
    Where did you set
    CurrDataport.FILENAME := VarFilename;
    
    ?
    You must set this on
    Dataport - OnPreDataport()
    

    Also if you use this Dataport to export, set the DataPort Property IMPORT to false

    Regards
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'Navision Attain' forum to 'Navision Financials' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ta5ta5 Member Posts: 1,164
    Hi
    Yes, I set currdataport.filename on preDataPort. The Problem is the currdataport.import property. It does not work if it is set at run time. This means the file dialog does always show "open" or "save" according to the property set at design time...
    Any other help would be appreciated.
    Thanks
    Thomas
  • garakgarak Member Posts: 3,263
    As i said:
    set the DataPort Property IMPORT to false

    To set the porperty open dataport in Design mode -> go to a empty line of DataItem -> go to Property (Properties of the Dataport) -> Import (default is <yes>) -> NO -> Save the Dataport -> Test you dataport -> it works fine ;-)

    Regards
    Do you make it right, it works too!
  • ta5ta5 Member Posts: 1,164
    Hi
    Sorry, I think my question was a bit confusing. Actually we could write in german :mrgreen:
    My problem is the following (sorry if you got it already):
    I have a dataport with custom options, therefore the direction option and the file dialog are gone. I re-create them and all works ok, except the fact that the direction option does not work for the wizard.
    This means that if I open the file dialog, it's always "open" or "save" as set in design time. Actually I think that if I set currdataport.import(false), then the dialog should be a "save" dialog and vice versa. The problem with this is, when I want to export and the file does not exist, an error is thrown: "file xyz.txt not found".

    Thanks
    Thomas
  • garakgarak Member Posts: 3,263
    german is better for me and for you, but not for the community ;-)

    ok, if i underst. it correct, then you will use your Dataport (with custom made request form) for import AND export.
    Do you make it right, it works too!
  • ta5ta5 Member Posts: 1,164
    garak wrote:
    ok, if i underst. it correct, then you will use your Dataport (with custom made request form) for import AND export.
    Yes, thats the case.
  • garakgarak Member Posts: 3,263
    Sorry, for this case i know no way.

    The only is: Set all your customized fields, for example, in a Report (or Form) and run from there the Dataport (call a Function in Dataport from Report / Form to set the values of variabels).

    Regards
    Do you make it right, it works too!
  • ta5ta5 Member Posts: 1,164
    :cry:
    Thats what I expected...

    Thank anyway for your valuable 2nd opinion
    Thomas
  • garakgarak Member Posts: 3,263
    amendment: You can also use the report for import / export the data (Variable of type File).

    The file open Dialog is there also no problem.

    Regards
    Do you make it right, it works too!
  • kinekine Member Posts: 12,562
    In your case it will be better to not use the COntrol ID = 1 trick and better will be to add code into OnAssistEdit of the control which will use the COmmon Dialog codeunit to pen correct dialog for you based on the Import/Export selection... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    ](*,) the easiest solution and i see the wood not for the trees ](*,) :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :cry::cry::cry::cry:

    Here the source:

    if you realy use Financials, you doesn't have the codeunit 412 Common Dialog Management. But in the Client Folder must be an ocx like mscomdlg.ocx (or so [Microsoft Common Dialog Control, version 6.0])
    TextBox - OnAssistEdit()
    OptionValue is a Varaible of Type Option (import,export)
    
    clear(CmDlgMgmt);
    OptionValue := 0;
    Fielname := CmDlgMgmt.OpenFile('Window Title',Fielname,1,'*.txt|*.*',OptionValue);
    CurrDataport.IMPORT(OptionValue = 0);
    
    Dataport - OnPreDataport()
    CurrDataport.FILENAME := Fielname;
    

    Regards
    Do you make it right, it works too!
  • kinekine Member Posts: 12,562
    Garak, that's normal... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    maybe Kamil, i need holiday :-(

    Regards
    René
    Do you make it right, it works too!
  • ta5ta5 Member Posts: 1,164
    garak wrote:
    if you realy use Financials, you doesn't have the codeunit 412 Common Dialog Management. But in the Client Folder must be an ocx like mscomdlg.ocx (or so [Microsoft Common Dialog Control, version 6.0])
    Regards

    Hi folks
    Thanks for all input. We really use financial in this case. So the solution is to use cu412 from a 4.0 or so?
    Thanks
    Thomas
  • kinekine Member Posts: 12,562
    You can, if your license have permissions for this ID...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    this is only possible if the customer license allow it to use this codeunit.
    But in your client folder mus be a ocx called comdlg32.ocx.
    This ocx you use as variable. Before register this DLL with Financials: Tools -> Custom Controls -> Control -> Browse (Extras -> Benutzerdefinierte Controls -> Control -> Suchen)

    Now you can use thios ocx as Variable.

    the source must look like:
    Name	DataType	Subtype	Length
    CommonDialogControl	OCX	Microsoft Common Dialog Control, version 6.0	
    
    CommonDialogControl.FileName := DefaultFileName;
    CommonDialogControl.DialogTitle := WindowTitle;
    CommonDialogControl.Filter := YOUREXTENSIONFILTER;
    
    CommonDialogControl.InitDir := YOURINITDIR //C:\someFolder;
    if (OptionValue = 0)  //import then
      CommonDialogControl.ShowOpen
    else
      CommonDialogControl.ShowSave;
    
    EXIT(CommonDialogControl.FileName);
    

    Regards
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,110
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ta5ta5 Member Posts: 1,164
    Great!
    Thanks a lot, this forum is really very friendly and helpful!
    Thomas
  • garakgarak Member Posts: 3,263
    this forum is really very friendly and helpful!

    on this reason we are all members ;-)
    Do you make it right, it works too!
Sign In or Register to comment.