How to use the asci2ansi converter in a dataport

Hi, I just downloaded the ascii2ansi converter from http://www.mibuso.com/dlinfo.asp?FileID=287 but I can’t fin any instructions on how to use these functions from a dataport. Does anybody know how to do this ? Thanks, …Bjarte

Hi, You have to call the functions “Ansi2Ascii” or “Ascii2Ansi” in the following Triggers of EACH Dataport Field OnAfterFormatField(VAR Text : Text[1024]) OnBeforeEvaluateField(VAR Text : Text[1024]) i.e. you have a field “Description”, you want to make an export: OnAfterFormatField(VAR Text : Text[1024]) Text := Ascii2Ansi(Text); br Josef Metz

Maybe what Bjarte doesn’t know is how to access the OnAfterFormatField and OnBeforeEvaluateField triggers? You can get to where Josef says by being in the Dataport Designer, opening the Field Designer (View, Dataport Fields) and finally opening the C/AL Code (F9) for each field.

Thanks a lot Josef and Nelson, I’ll try it out right away ! regards, …Bjarte

You can also use the converter direct in the SourceExpr field. Select DataItem then View - Dataport fields. Your simply write asci2ansi(Description) and the field is converted without use of writing any triggers. Just remember to call MakeVar() in OnPreDataport

I’m also interested in using this CU. I understand what is described in the messages before, but how do I tell the dataport that it should use CU 9999 [:I]? Should I define a Global Variable of type Codeunit referring to 9999? How should it be called? Should I define more variables? Can anyone give me a clue?

I defined a global variabel of type codeunit, subtype 99999 (this codeunit) and named the variable konv Then I referenced the functions as konv.ascii2ansi etc. Ex: konv.ascii2ansi(Description) (in the SourceExpr Field) Good Luck …Bjarte

Great! [:D]

Bjarte, Exporting from navision goes well, but after changing in Excel,when importing the .csv-file I receive this message: ‘The SourceExpr of data item no. 0 field no. 1 should be a variable to import.’ My Data Item is Customer. The two fields SourceExpr are ‘No.’ and ‘conv.Ansi2Ascii(Name)’. What am I doing wrong?

OK. Figured out that I won’t have to use ansi2ascii when importing if I save the Excel file as CSV (MSDOS).