Dataport and default option tab

manifoldmanifold Member Posts: 7
Hello!

When creating a new and simple dataport, there will be an automatically created option tab. That tab includes fields eg. "File name" and "Direction (import/export)". I'm not 100% sure whether this is a feature of the basic Navision, but I assume so.

Anyway, by default the "Direction" -option is either Import or Export. Now I wanted that the user MUST make the decision every time he/she uses the dataport (to prevent the "oops-phenomenon"). The options are therefore:

a) Nothing is selected by default and the process stops in error if the user don't choose anything.

b) There is a third, "NULL-option" (or something like that) and the process stops in error if the user don't make a reasonable decision.

The problem is that I can't find where I could edit the option-tab. If I open the "Request Form" its empty. If I add something on it, the above mentioned fields disappear... Any ideas where these options are?

PS. We don't have license to edit CAL-code/codeunits. Just forms, reports, etc... I hope that editing CAL-code is not the only option :?

Regards,

Timo Tasala

Comments

  • QuilaQuila Member Posts: 4
    Hi Timo

    The import/export and filename settings are standard Navision.
    You can edit these values on the dataport property window.
    - in the editor go to first blank line after dataitem and hit the property button.

    But there is no way around it without coding to "enlarge" the option with an extra optionvalue - i.e. for import/export with a <blank>

    A quick solution could be to make a copy of the dataport and use 1 for imports and 1 for exports.

    Or else make a new variable in the dataport of type option with <blank>,import,export and then on the onpredataport-trigger set the import/export property or return an error if blank. I don't know if your license gives permission to that or not.


    Kindly

    Quila
  • kinekine Member Posts: 12,562
    Way around is to create your own requestform where you will add your controls and through code you will set the parameters based on this. But you will need some C/AL code to do that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Ok, here's what you need to do:

    1. Create FileName as text variable
    2. Create ImportDirection as option variable
    3. Go to the request form, add a text box. Change the ID property to 1
    4. Add radio buttons with your options
    5. On the Dataport OnPreDataport trigger, type in
    CurrDataport.FILENAME(FileName)
    
    6. On the Dataport OnPreDataport trigger, type in your code something like this:
    CASE ImportDirection OF
      ImportDirection::Nothing : error();
      ImportDirection::Import : CurrDataport.IMPORT(TRUE);
      ImportDirection::Export : CurrDataport.IMPORT(FALSE);
    END;
    

    Look at the C/SIDE reference guide, it has the functions documented.[/code]
  • VWohdeVWohde Member Posts: 13
    Hello,

    i have create a dataport like you describe. But when I choose (by default)

    CurrDataport.Import(false);

    an i Click the Assistbutton for the Filename the System opens the OpenDialog instead of the SaveDialog.

    Any ideas how i can solve this problem?

    Vwohde

    PS: Sorry for my bad English
  • RobertMoRobertMo Member Posts: 484
    Savatage wrote:
    Thanks for the post. It made me think and I also found some improvements to the suggested solution.
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • SavatageSavatage Member Posts: 7,142
    Sounds Great - Welcome Back!!

    \:D/
  • Captain_DX4Captain_DX4 Member Posts: 230
    kine wrote:
    Way around is to create your own requestform where you will add your controls and through code you will set the parameters based on this. But you will need some C/AL code to do that...

    An interesting aside for people who haven't worked with a license other than a full developer, the Dataport/Report Editor license granule does allow you to edit the code within the Report or Dataport object, just not create/edit any Codeunit objects.

    Cheers!
    Kristopher Webb
    Microsoft Dynamics NAV Developer
  • DenSterDenSter Member Posts: 8,307
    Funny story about that.... One of our customers hired a SQL Server guru that was also a good VB developer. This guy wanted to start programming their NAV database right away and found out he only had access to report code. So a few months later, I went back onsite and found almost a hundred reports with code modifications that complement posting routines.
  • Captain_DX4Captain_DX4 Member Posts: 230
    *lol* Give a man a fish, he eats for that day. Teach a man to fish, he starts a fish factory?
    Kristopher Webb
    Microsoft Dynamics NAV Developer
Sign In or Register to comment.