Even though Calgary AB has been hit with massive flooding my area of town is ok. While out helping a few friends in the stricken area I had a bit of a brainstorm on how to give a quick way to create a csv file used with lookup values as found in the hooks folder. This method means you do not need to update the csv file then upload it. It is all handled for you in a separate table to which only admin or whomever you want has access.
This is based upon this example on the AppGini site but taken further.
http://www.bigprof.com/appgini/help/adv ... agic-files
Create a new table and call it what you wish but I call mine csvfiles
Fields are: (for example)
Create as many fields as you need csv files created.
Then in the hook file for the table for which you need the csv file created put in the following code under both after insert and after update
Code: Select all
$csvFile='tablename.fieldname.csv'; $fp=@fopen("$csvFile", "w"); fwrite($fp, $data['your_field_name']); fclose($fp); return '';
Or you could write one of the above for each filename.
This way you no longer have to edit the csv file and then upload it. You just enter the table, make your changes and it will overwrite the file for you. Only caution, the 'w' flag in the fopen command will overwrite the file each time.