Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 62 Insurance
- 536.1K On-Premises Infrastructure
- 138.2K Analytics Software
- 38.6K Application Development Software
- 5.7K Cloud Platform
- 109.4K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.2K Integration
- 41.6K Security Software
Data sync error due to custom before import script

Hi Experts,
I have an issue while trying to use data sync functionality to copy data from one application to another.
Issue seems to generate due to a custom "before import" script which checks POV period with file period.
Can i change the script below so that it does not runs for data sync location/ for specific data load rule?
#----------------------------------------------------------------------
# Import section
#----------------------------------------------------------------------
from codecs import open
from os import path
#----------------------------------------------------------------------
# Context
#----------------------------------------------------------------------
fileName = fdmContext["FILENAME"]
locName = fdmContext["LOCNAME"]
inboxDir = fdmContext["INBOXDIR"]
periodKey = str(fdmContext["PERIODKEY"])
#----------------------------------------------------------------------
# Constant section
#----------------------------------------------------------------------
POVMarker = "Year to date as of "
dictPOVMarker = {
"Argentina": "PERIOD :"
}
#----------------------------------------------------------------------
# Event script code
#----------------------------------------------------------------------
# open source file and read header
msg = ""
if fileName.find(".xls") < 0:
filePath = path.join(inboxDir, locName, fileName)
try:
oFile = open(filePath, "r")
fdmAPI.logDebug("File %s opened" %(filePath))
except:
fdmAPI.logInfo("Error opening file %s" %(filePath))
line = oFile.readline().strip()
# get details from POV
# sample line looks like Year to date as of 08-2018'
POVMarker = dictPOVMarker.get(locName, POVMarker)
position = line.find(POVMarker) + len(POVMarker)
if line.find(POVMarker) >= 0:
periodFile = line[position:position + 2]
yearFile = line[position + 3 :position + 7]
else:
errMsg = "File does not contain POV Marker"
fdmAPI.showCustomMessage(errMsg)
Best Answer
-
if locName == "YourLocation" :
Answers
-
Yes, we can make the event script code location specific. you are already capturing the location name you can restrict the code to the location you require
-
Thanks for your response. Can you also please suggest the script for restricting the location code so that it does not run the script for other locations?
-
It should be simple as below
locName = fdmContext["LOCNAME"]
if locName = "YourLocation" :
All your above code..
-
if locName == "YourLocation" :