FileName in a Dataport

Hello. 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… ! Greets Markus !

From the CSIDE Reference Guide: “FILENAME 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]) CurrFileName Data type: text The current setting of FileName property. NewFileName Data type: text The new setting of FileName property. Comments 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: CurrFile.QUERYREPLACE(FALSE); MyFileName := STRSUBSTNO(‘C:\temp%1.txt’, Segment.“No.”); CurrDataport.FILENAME(MyFileName); 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…! [8D]

[quote]