Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
I have a batch class which reads the info log messages from BatchHistoryTable and inserts them into a Custom Regular table using insert(). The job works fine. I just need to put a validation that the records don't repeat depending on these three fields.
I want to have a check in my batch class which reads the data in a Custom table before inserting.
If Document#, EmployeeID and Assignment are not found in a table for a single record then insert() or else no. In other works these three fields should always be unique for every row in a table.
How can I achieve this functionality thourgh X++ ? or f there is any other way of doing this ?
Please let me know if my question is not properly asked and I will do my best to elaborate further.
First of all, create new index with these 3 fields and set allowDuplicates = No. This will prevent any code inserting a duplicate and throw an error. Now when you have index in place before inserting data into the table do a select by these 3 fields and if there is nothing in DB then do insert.
I made indexes for the three fields and did as you said. Now my job runs fine and inserts data accordingly. I have tried sending the duplicate data to the table for testing and duplicates were not inserted. As they shouldnt!!
I have same scenario . Can you share Job X++ code please.
I can do it monday morning. I dont have access to the system as of now.
X++ code for exactly which part ? Code validation ?
I need both. Insert info message to Custom table and validation.
Business Applications communities