[solved] Dataport Export separate Field

SV_WillSV_Will Member Posts: 12
Hi, I´m trying to create a Dataport to export into a txt file. Each field is seperated with ; but I need to seperate a NAV field into 6 different fields in the txt file eg:

Z5.30-35.hj.zd -> z5;30;35;hj;zd

Any ideas?
Thanks

Comments

  • BgestelBgestel Member Posts: 136
    just to get you started.

    Make 6 global variables and use them as dataport fields

    now use the copystr function in the onbeforeexportrecord to cut youre field into pieces and assign the pieces to the variables.
    **********************
    ** SI ** Bert Van Gestel **
    **********************
  • BgestelBgestel Member Posts: 136
    or you just can replace the dots and minus signs with semi's

    and export the field
    **********************
    ** SI ** Bert Van Gestel **
    **********************
  • SV_WillSV_Will Member Posts: 12
    Bgestel wrote:
    or you just can replace the dots and minus signs with semi's

    and export the field

    Thanks a lot !!!
  • emulsifiedemulsified Member Posts: 139
    I'm trying to do something similar but I want to STRIP out special characters.

    My Dataport is on Customers with three fields:

    "No."
    "Postal Code"
    Name


    I want to remove all special characters from the Name field and I thought I could use DELCHR somehow in the OnBeforeExportRecord():

    Name := DELCHR(Name,'=','-_+=\|[]}{".,#$@%^&amp;*+!~`:;/?><');

    How do I reference the Name field make my changes before the information gets exported?
    Half-empy or half-full how do you view your database?

    Thanks.
  • SavatageSavatage Member Posts: 7,142
    Instead of using the actual Navision Fields Like Name.
    For Import Example
    Create a variables called
    vName Type Text.
    txtCharstokeep Type Text.
    On the dataport fields instead of putting Name you type in vName.

    Now add the code
    txtCharsToKeep := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '; 
    Customer.Name := DELCHR(vName,'=',DELCHR(vName,'=',txtCharsToKeep));
    
    or your way..................
    Customer.Name := DELCHR(vName,'=','-_+=\|[]}{".,#$@%^&*+!~`:;/?><');
    

    For Export Example
    Switch the places where Customer.Name & vName are in the code.
    On the dataport fields instead of putting Name you type in vName.
    vName := DELCHR(Customer.Name,'=','-_+=\|[]}{".,#$@%^&*+!~`:;/?><');
    
    Now it will export the vName field with the corrections you wanted.
Sign In or Register to comment.