Designer Posted November 1, 2006 Posted November 1, 2006 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!
mr_vodka Posted November 1, 2006 Posted November 1, 2006 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
Designer Posted November 15, 2006 Author Posted November 15, 2006 Thanks for your help Mr Vodka. I don't understand what globalTempPartNumber means though.
mr_vodka Posted November 15, 2006 Posted November 15, 2006 // 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.
Recommended Posts
This topic is 6578 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now