Dynamics User Group - Archived Forums

The forums in this section of DUG are no longer accepting new post, but you can still get lots of value from the old posts here.
Please visit the active forums to comment/post new questions (choose which product you are interested in):

FileName in a Dataport

This is my first Questions in this Forum.

In my Navision System I created a new Dataport to export Segment Lines from the Marketing Tool.
It works good. But now I want to start the Dataport automatically with a variable FileName.

The FileName should automatically created to "C:\Temp\" an then the Segment."No." which is exported an "TXT".

Can anyone help me and give the code to do this?

Thanks.... !

Markus !
  • From the CSIDE Reference Guide:

    Use this function to return the current setting of the FileName property of a dataport, and to set this property to a new value.

    [CurrFileName] := FILENAME([NewFileName])


    Data type: text

    The current setting of FileName property.

    Data type: text

    The new setting of FileName property.

    See the description of the FileName property for details."

    Use it in the dataport oninit trigger.

    Good luck! //Pelle
  • This i tested before i posted here in the forum.
    But it didn't work.

    I don't understand, what is my CurrFileName?
    The NewFileName is ok.

  • Hi,

    Simply put the following code in the OnInitDataport() trigger:

    MyFileName := STRSUBSTNO('C:\temp\%1.txt', Segment."No.");

    And of course, the Segment."No." must be known at the time [8D]

  • Wow ...

    It tried the code and it works !

    Thanks for your help...!