Dataport for transfering data from one table definition to another table definition?

This is the problem im having. I have a table which has a field (among others) type boolean, and now i want to transfor that sam field to option. But i have to keep the data. If bool variable is TRUE than i have option 1, etc. I have an idea to use dataport to export the data from begining table, then import the new table definition, than import the (exported) data. Now i need to somehow transform the data from text file to coresponding data in new table definition. I have decided to use onBeforeImportRecord trigger on the same dataport.

But i dont know how to tell him to transform the selected coma-separated piece of data in the desired field of the new table?

How can i tell the dataport that i want the (exg.) seventh comma separated piece of data to be put in the field i wish?

Is there another way of dealing with this problem?

Thanks in advance

Hey,

You have to put a variable in the Dataport fields list, on position 7.
Then in OnAfterImport-trigger (This trigger is fired after the file is read, but before data is put into the database) you check what value you have read, and sets the corresponding field to what ever value you need accordingly.
In the OnBeforeImport-trigger you must remember to clear the variable, to make sure you don’t inherrit any values from earlier lines in the file.

If you want to use the same dataport for the export, then remember that in position 7 you now also export the value of the variable, and not the actual field.
You then have to put the value into the variable in the OnBeforeExport-trigger

Thanks sander7, this is exactley what i needed. :slight_smile: