November 1, 200619 yr I need to know how to write a script that will copy a part number and a QC ID number from the current table, go to another related table and perform a find in both fields, and then either: a - Display the existing found record as a QC Form, or b - If "No records match this set of find requests", create a new record with that part number and QC ID number and display the QC form. So basically, I'd like to click the button and see the QC form whether it's a NEW QC form or an already EXISTING form. How do I script that? Thanks!
November 1, 200619 yr If you want to do a scripted find you can take a look at this thread, but in your case I would suggest just creating a relationship keyed on part number and QC ID. Then using a Go to Related Record go to the QC Form layout that you want. The script that runs it should be much shorter. If [is Empty [PartNumQCIDRelationhipName::QCID] ] Set Field [ globalTempPartNumber; PartNum ] Set Field [ globalTempQCID; QCID ] Go to Layout [ QC Form ] Set Field [ QCForm_PartNum; globalTempPartNumber ] Set Field [ QCForm_QCID; globalTempQCID ] Commit Record [] Else Go to Related Record [using Layout QC Form ] End If
November 15, 200619 yr Author Thanks for your help Mr Vodka. I don't understand what globalTempPartNumber means though.
November 15, 200619 yr // If there are no related records If [ Is Empty [PartNumQCIDRelationhipName::QCID] ] // Temp storage of PartNum and QCID Set Field [ globalTempPartNumber; PartNum ] Set Field [ globalTempQCID; QCID ] // Adds the new record Go to Layout [ QC Form ] New Record/Request Set Field [ QCForm_PartNum; globalTempPartNumber ] Set Field [ QCForm_QCID; globalTempQCID ] Commit Record [] // If there are related records Else Go to Related Record [using Layout QC Form ] End If I made some comments so its easier for you to follow. While checking my last post, I noticed that I missed the new record step. Sorry happens sometimes when typing off top of the head.
Create an account or sign in to comment