Charlih Chen Posted February 13, 2006 Posted February 13, 2006 Hello ALL: Q: How to write the script on FM pro7 to log a record from TABLE1 to TABLE2 w/ a new record_ID. OK, here is my case: ==================== I have a FM pro7 file called DoorAccess Management which has two table: DoorAcces and DoorAccessLog. Both Table has ID, Key#, AccessLevel, Employee. Once the Door key was assignned to other Employee, I will like to log the old record w/ old employee name to DoorAccessLog table. How to do so? Thank you for help.
Charlih Chen Posted February 16, 2006 Author Posted February 16, 2006 Hello there: Yes, I am using the import function. but the script seems has problem. The script is logging all the record(s). Well, all I need to do is logging the current openning record. OK, here is the content of the script. Go to Layout ["Form View - Log" (DoorAccess Management)] Import Records [No dialog; "DoorAccess Management.fp7"; Add; Windows ANSI] So, where can I assign it to import the current reord? (The only one record to import.)
LaRetta Posted February 16, 2006 Posted February 16, 2006 (edited) Hi Charlih, To import only one record, you must first isolate it in DoorAccess (from all the other records). Imports always pull an entire record set so you need a found set of ONE. Then when you go to your Form (in DoorAccess Log) and perform your import, only the one record will import. Envision this please and see if it might work for you - script activates on DoorAccess form which 'moves' the old Employee to the Log as follows: Freeze Window Loop Show All Records Omit Record Show Omitted Only Exit Loop If [ Get(FoundCount) = 1 ] End Loop Go To Layout [ "Form View - Log" (DoorAccess Log) ] Import Records [ No Dialog ; "DoorAccess Management.fp7" ; Add ; Windows ANSI ] Show All Records Go To Layout [ original layout ] Show All Records This will leave you back on your DoorAccess layout on the same record. You can then finish your script by changing it to the new Employee. Your SOURCE would be DoorAccess (after you specify DoorAccess Management.fp7) and your DESTINATION will be your DoorAccess Log table. The loop is to protect in case of multi-user solution. UPDATE: Oh ... I REALLY tried to let it go but there are probably easier ways to move/create only one record other than import and I feel obligated to mention it. But since I didn't know your structure, and since you seemed already 'in to' the import idea, I didn't want to write volumes (smile) or add confusion to the mix. You already KNOW how to do the import and it should work for you just fine. LaRetta Edited February 16, 2006 by Guest Added Update
Recommended Posts
This topic is 6858 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