Browse Source

Adding updateEntry function to set values to fields that can be computed from other fields in entry

Andrej 1 month ago
parent
commit
ecb8d2d2e0
1 changed files with 7 additions and 1 deletions
  1. 7 1
      importXLSX.py

+ 7 - 1
importXLSX.py

@@ -313,12 +313,17 @@ def convertLookup(xlsColumnName):
 def rowValid(df,r):
    return True
 
+def updateEntry(e):
+   pass
+
 def importData(pars,filename,getId=getId,modify=modify,\
    convertLookup=convertLookup,dryRun=True,debug=True,
-   rowValid=rowValid):
+   rowValid=rowValid,updateEntry=updateEntry):
 #master routine that imports data based on pars, 
 #applies user supplied functions modify, convertLookup and get Id and 
 #updates relevant database
+#rowValid signals a valid row, argument is current row from xlsx
+#updateEntry adds fields that can be computed from other fields in entry
 
 #some useful fields from pars (d is for default value)
 # - skiprows removes irelevant rows (number, d: 0)
@@ -415,6 +420,7 @@ def importData(pars,filename,getId=getId,modify=modify,\
          entry['Date']=entry[dateVariable]
       except KeyError:
          pass
+      updateEntry(entry)
 
       entries.append(entry)