Record

Hi everybody, Is it possible to have a record pointing dinamically either on table 18 and table 23. (avoid too much silly coding) Thank you very much

A Variable pointing to two different tables … no A Table Relation for a field to two different tables … yes (ala Sales Line, etc) Chris Krantz NCSD,NCSQL,MCSD,MCSE Microforum Inc. Toronto, Ontario, Canada

Without knowing why, it’s difficult to propose a solution. I haven’t been able to find a solution that directly answers your question. The best workaround I’ve come up with is an array series that can be populated with either the Vendor or Customer record as required. You would still need two record variables, and then based on your condition, populate the array from the appropariate record variable.

Please describe what you’re trying to achieve, and what you’ve tried so far, Christophe! We may be able to help you! Kind regards, Jan Hoek Weha Automatisering BV Woerden - The Netherlands

Hi, In fact, i have a file with all the third parties (either customer or vendor) => table third party I have another file with the type of third party (ie customer or vendor) => table role Then I want to create and populate each table 18 or 23 with all information (Account No, address,…) so better to silly code as if Type = customer then reccustomer.xxx=yyy reccustomer.zzz=aaa else recvendor.xxx=bbb recvendor.zzz=ccc I want to do is if type=customer then rec= reccustomer else rec=recvendor rec.xxx=aaa rec.yyy=bbb rec.zzz=ccc Thanks for your help

Using the WITH block, it is a pretty simple cut and paste to have 2 sections writing to different records. This is probably the easiest for readability if someone else ever has to look at your code. Having said that, there may be a cheat if you really must use only 1 record. Because the tables are so similar (Common field number for Address,etc.), you could create a new table with all the fields you want to update. Update the fields on the new table and then use transferfields to copy the new table record to either customer or vendor. This will only work if the fields are the same field number in both tables and Is not nearly worth the hassle of just having duplicate code.

Why don’t you use (or have a look at) ‘Contacts’. If you change the Name, Adress etc from a contact linked to a customer and a vendor, Navision also updates the customer and vendor data.