AnsweredAssumed Answered

Only Import Records based on find

Question asked by NetDude on Jan 7, 2013
Latest reply on Jan 9, 2013 by philmodjunk

Title

Only Import Records based on find

Post

     Scenerio: Only Import records based on the absence of a Variable ID via the Enter Find Mode function

     Set Variable[$VendorID; Value:Vendor::ven_id ---- STEP ONE IS TO SET VARIABLE BASED ON THE CURRENT RECORD
Show Custom Dialog ["Alert"; "Here is the ID of the variable"; & $VendorID] ---- USED FOR ENSURING THAT THE VARIABLE IS CORRECT
     Go to Layout ["x_vendor_component_function"(x_vendor_component_function)]
     Enter Find Mode --- STEP TWO GO TO LAYOUT AND ENTER FIND MODE
     Set Field [x_vendor_component_function::ven_id = $VendorID] 
     Perform Find [] ---STEP 3 SET THE FIELD ven_id TO THE VARIABLE ESTABLISHED IN STEP 1

     // NEXT IT TO SET ANOTHER VARIABLE ACCORDING TO HOW MANY RECORDS WERE FOUND
     Set Variable [$VenIDCount; Value:Get (FounfCount)
     // IF THE RESULTS GENERATED INTICATED 1 OR MORE RESULTS THEN SHOW ALERT
     If [$VenIDCount ≥ 1 
      Show Custom Dialog ["Alert"; "There is a record that already exists in this table"]
     // ELSE MOVE FORWARD WITH IMPORTING
     Else
      Import Records ["Functional Requirements.fmp12"; Add Mac Roman]
      Replase Field Contents [No Dialog; x_vendor_component_fuction::ven_id; $VendorID]
     End If

      

     So the first time a record is created the expected results would be that FM throws up a "No Records match this find crieria" This works upon executing the script from a button located on the main record page.
     Q1: Is there a way to overide it so that a user does not see this uaotmated prompt but rather the scripts simply just continues running

     After hitting continue the import process begins and the user can view the various fields setup in the import field mapper
     Q2) Is there a way for this pop-up "Import Field Mapping" not to display but rather to move on with the import process

     When cmpleted the Import Summary window is now displayed, great way to assure the correct number of records are being imported Cool

     Now lets say the user accidentaly hits the button to run the import script, emmediately the user receives the same message "No records match this find criteria" 
     Q3) Why, The record does infact exist where by resulting in an expected record count of somesort. In this case the above script should simply alert then and nothing more.

Outcomes