1 Reply Latest reply on Dec 3, 2013 7:42 PM by Francisco Amores

    How to cancel Import process with Script?




      We are currently developing a project in FDM and I would like to know if it´s possible to change the status of the workflow from Scripting.


      We want to implement a check in the import phase to verify that the file name matchs with the current period of the POV, for example:


      Filename: 2013Dec_Company002.dat


      We can check the name of the file to be imported, but we don´t find the way to avoid the user to follow the next workflow steps..


      We have tried the next code but it allows to user to continue :


      Option 1 - doesn´t work

      'Set the Workflow status to "Import OK"

      GobjAS.PobjAPI.MaintenanceMgr.mProcessLog _

      GobjAS.PobjAPI.POVMgr.PPOVLocation, _

      GobjAS.PobjAPI.POVMgr.PPOVCategory, _

      GobjAS.PobjAPI.POVMgr.PPOVPeriod, _

      enmProcessType.upImp, _

      False, _

      "Error in the filename..", _


      Option 2 - doesn´t work

      'Declare Local Variables
      Dim lngProcessType
      Dim blnProcessState
      Dim strProcessMsg

      'Set Workflow state values
      lngProcessType = 1                    '(See enmProcessType)
      blnProcessState = False               'False = Process Failed, True = Process Complete
      strProcessMsg = "YourString"     'Text Message for the process

      'Set the workflow state
      API.MaintenanceMgr.mProcessLog API.POVMgr.PPOVLocation, API.POVMgr.PPOVCategory, API.POVMgr.PPOVPeriod, CLng(lngProcessType), CLng(blnProcessState), CStr(strProcessMsg), Now()


        • 1. Re: How to cancel Import process with Script?
          Francisco Amores



          there are different ways of canceling the import process.


          For your requirements, you may not want to delete existing data in your POV if the file name does not match the active POV. Therefore you have to cancel the process before data clear is triggered


          One solution that can help you to meet your requirement is to implement the following code in the "StartProcess" event of ImportAction Script when the file is not valid


          If FileIsNotValid Then


               RES.PcolScriptInfo.Item(1).ColFlds.Item("Cancel").varValue = True

               RES.PlngActionType = 2

               RES.PstrActionValue = "File is not valid"

          End If


          The object PcolScriptInfo has different information based on the event (you can take a look to the API guide)


          I Hope that Helps