dav1089 Posted June 23, 2016 Posted June 23, 2016 (edited) Hello, I am trying to figure out a way to auto-import print job log (CSV file) into the FIlemaker every day. I know that I can schedule to run a script on Server. Now, the real issue is to setup script step where I add file. I want to import everyday log file which has that date as filename , so it's not same file I am importing.. everyday it changes and my scheduled script will import file at specific time from Server remotely. I would appreciate any suggestion. Thank you Edited June 23, 2016 by dav1089
comment Posted June 23, 2016 Posted June 23, 2016 I am not sure I understand what your question is about. 23 minutes ago, dav1089 said: I want to import everyday log file which has that date as filename Define a variable to construct the path to the file dynamically - for example: Set Variable [ $filePath; Value:"file:" & Get ( DocumentsPath ) & Year ( Get ( CurrentDate ) ) & SerialIncrement ( "00" ; Month ( Get ( CurrentDate ) ) ) & SerialIncrement ( "00" ; Day ( Get ( CurrentDate ) ) ) & ".csv" ] If run today, this will return the path to a file named "20160623.csv" located in the Documents folder. 21 minutes ago, dav1089 said: Now, the real issue is to setup script step where I add file. There is no step to "add a file". If you want to import from a file, then you need to use the Import Records [] step. In this step, use the $filePath variable to specify the file to import. See http://www.filemaker.com/help/15/fmp/en/#page/FMP_Help%2Fimport-records.html%23 regarding the limitations of the Import Records[] step when performed on the server. 1
dav1089 Posted June 23, 2016 Author Posted June 23, 2016 (edited) 4 minutes ago, comment said: Set Variable [ $filePath; Value:"file:" & Get ( DocumentsPath ) & Year ( Get ( CurrentDate ) ) & SerialIncrement ( "00" ; Month ( Get ( CurrentDate ) ) ) & SerialIncrement ( "00" ; Day ( Get ( CurrentDate ) ) ) & ".csv" ] Will it be file: or fmnet: ?? File will be hosted in the Server and sorry I want to auto-import from remote client where logs are stored. Edited June 23, 2016 by dav1089
comment Posted June 23, 2016 Posted June 23, 2016 Please read the link I have posted, esp. this part: Quote Any specified file must be in the FileMaker Server Documents folder, the temporary folder, or a child folder of either the FileMaker Server Documents folder or the temporary folder. 1
dav1089 Posted June 24, 2016 Author Posted June 24, 2016 (edited) Hi, I can't get it working (FIle Name is Job Log_3_JUN_2016.csv ) .. I used : "file:"& Get ( DocumentsPath ) &"Job Log Dump/Job Log_" & Day ( Get ( CurrentDate ) ) & "_" & Upper ( Left ( MonthName ( Get ( CurrentDate ) ) ; 3 ) ) & "_" & Year ( Get ( CurrentDate ) ) & ".csv" as Local Variable Value The Log Files are in Documents/Job Log Dump Folder on Server Now. Will it work if I make the Path absolute instead of relative (Get (DocumentsPath) )? Edited June 24, 2016 by dav1089
dav1089 Posted June 24, 2016 Author Posted June 24, 2016 (edited) I finally found a workaround to populate field names, Link is : (In my case, source file has more fields than target table) http://www.soliantconsulting.com/blog/2014/01/mapping-scripted-imports-variable-paths Another Resource which helped me: http://help.filemaker.com/app/answers/detail/a_id/7035/~/import%2Fexport-script-on-filemaker-server Edited June 24, 2016 by dav1089
dav1089 Posted June 27, 2016 Author Posted June 27, 2016 Hi, So I was able to map the fields and schedule script in the Filemaker Server .. Now, The schedule runs fine with no error and I receive notification: But it doesn't actually import any records into the file Now to troubleshoot this, I ran the script manually and it imported records fine... So what is missing?
Recommended Posts
This topic is 3343 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now