AnsweredAssumed Answered

Script for populating fks.

Question asked by JohnDee on Nov 12, 2013
Latest reply on Nov 12, 2013 by philmodjunk


Script for populating fks.


     Can I just run this by you guys to tell me what you think. I need a few more experienced eyes to catch any mistakes here, since this will be the backbone for a lot of operations in my db.


     Set Variable [ $Var; Value: Get ( ActiveFieldContents ) ]

     Go to Layout [ “‘Clients” (Clients) ]

     Perform Find [ Specified Find Requests: Find Records; Criteria: Clients::NameSurname “=$Var” ] [ Restore ]

     Set Variable [ $Var2; Value:Clkients::_pk_Client_List_Serial_Number ]

     Go to Layout [ original layout ]

     Set Field [ Projects::__fkClientID; Projects::__fkClientID=$Var2 ]

     Commit Records/Requests

     Exit Script [ ]


     So basically I am in the Projects layout, grabbing a Client name inputted via predefined value list based on the available clients in the table, finding it in the clients table, then going back and pasting this id in the Projects layout. 


     This is for a simple case not the case of a joint table, which maybe I ‘ll post later. 


     Is this good practice? I want to start, so to speak, on the right foot here in terms of good practice.