FileName and dataport

HanenHanen Member Posts: 281
Hi,

How can I automatically export data using dataport to an external file dynamically, I've tried something like that but :cry:
//Hardcode path to save output file.
FilePath := 'C:\';
FDate  := "G/L Entry".GETRANGEMIN("Posting Date");
FName := 'BanK+FORMAT(FDate,0,'<Month,2><Filler Character,0><Day,2><Filler Character,0><Year4>') +'.txt' ;
FileName := FilePath + FName;

Thanks for help.
Regards

Hanen TALBI

Comments

  • ShedmanShedman Member Posts: 194
    Try
    CurrDataport.FILENAME := FilePath + FName;
    

    I wouldn't actually call that hardcoding by the way. Hardcoding would be something like
    CurrDataport.FILENAME := 'C:\Filename.txt';
    
  • HanenHanen Member Posts: 281
    It didn't work :cry:
    Help :(
    Regards

    Hanen TALBI
  • deprodepro Member Posts: 46
    1. Did you get any error?
    2. In what trigger do you put your code? - I put code like that in trigger: Dataport - OnPreDataport() and it works.
    3. Check your string "FName"value in debugger.

    regards,
    Depro
  • HanenHanen Member Posts: 281
    I put it on the postdataport item, but it didn't work :(
    Any suggestions?
    Regards

    Hanen TALBI
  • SavatageSavatage Member Posts: 7,142
    Hanen wrote:
    I put it on the postdataport item, but it didn't work :(
    Any suggestions?
    The above post suggests On PREDataPort Not Postdataitem. Set the name first not after the dataport is already run.
  • HanenHanen Member Posts: 281
    Thanks it works :thumbsup:
    Regards

    Hanen TALBI
Sign In or Register to comment.