I have two tables, both containing customer information, but from two different sources. So the field names don’t easily map.
I have created a “mapping” table, with 5 fields in it:
id LONG ! Autonumber
LeftFieldName STRING(50)
LeftFieldType STRING(10)
RightFieldName STRING(50)
RightFieldType STRING(10)
So when I populate this table I’d like to choose from a drop-down list. The list would be obtained by reading the structure of each table, and obtaining the field name and type. The left table is called “LeftCust” and the right table is called “RightCust”.
Where do I begin? The shorter of the two tables has 24 fields, so I could just create a text file from the dictionary for each table and type the data in by hand, but I would like to learn how to do it properly.
Any suggestions or pointers would be most welcome.
You could write a template to generate the code. Getting the Type from the DCT is easy, getting it at runtime usually repairs TUFO that is unsupported.
You are welcome to borrow from this if you find it useful. It’s from my old mailmerge template. I’m sure there are better ways.FieldExport.zip (1.1 KB)
I’m going to synchronise records between the two tables, adding records to RightCust that exist in LeftCust, and updating LeftCust with new data from RightCust.
After I posted this, I realised that I’ll have to hard-code the mapping, so I don’t need the table at all. Jeff’s template code pointed me to the same conclusion. Thanks everyone.