January 6, 200917 yr Hi there, See the attached file. Before performing an entry in the General Ledger, I want to make sure there are no duplicates of the data I am about to transfer there. Please check the Search Duplicates script in the General Ledger file and see what's wrong. To figure out how the data transfer works, it all starts with the Entry General Ledger script in the Accounts Payable file. See the Blue Book icon on the left-hand side in the same file. Thanks Accounting.zip
January 6, 200917 yr Well, I think you meant to have "Halt Script" instead of "Exit Script" in the General ledger Search Duplicates script. But, there are a few potential pitfalls with this routine. Why not just create a relationship between account code and ledger code and check for the existence of related records to avoid dupes?
January 6, 200917 yr The issue is: If [ GeneralLedger::Counter = 1 ] ... you think you only have one record End If ... but, you are checking only the current record's field named Counter to see if it contains a 1. You should instead use: If [ Get ( FoundCount ) = 1 ] because if your found count is greater than 1 then you have a duplicate. LaRetta
January 6, 200917 yr I believe that the the OP considers a 'duplicate' to be a potential duplicate - when a single record already exists with the specified ledger code, not two or more. See the 'Entry General Ledger' script in the accounts file that triggers the find duplicates subscript. So, his original if statement will work (because it is really checking for any records being found at all), but will not stop the original script from completing (because 'Exit Script' is being used instead of 'Halt Script') as is the suggested functionality. Either way, we have demonstrated one of the potential pitfalls of this design - not very intuitive. Edited January 6, 200917 yr by Guest added script name
January 6, 200917 yr Thanks. I confess that I didn't check it very carefully this time; I spotted that If[] test and answered. And you are right ... not very intuitive.
January 6, 200917 yr Author I just replaced the Exit script by Halt and it worked fine. Thank you guys for the tip!
Create an account or sign in to comment