Ah, the oops I forgot it problem.
I do this a different way. I use the csv file option. So for each list I create a csv file which is then read in when the list is generated. (See this link)
http://www.bigprof.com/appgini/help/adv ... agic-files
This method means I do not have to:
1. Fix the list
2. Regenerate the app
3. Upload it
4. etc
Benefits is that anyone can then add to the lists or fix mistakes in spelling etc. It also keeps someone from filling stupid answers if they do not find an item in a list they like. For example I am sure we have all seen this: Profession (with a set # of options). If there is a type in your own field someone always puts in "Yes I have one".
But what I do is also create a seperate table. Admin access only.
In this table I create a field for each of the fields in other tables which have a list. (For example: list of provinces, cities, districts)
Then in this new table I have fields named: provinces, cities, districts
In the hook file for this new table I enter the following code:
Code: Select all
function notification_reasons_after_insert($data, $memberInfo, &$args){
$csvFile='notifications.prov.csv';
$fp=@fopen("hooks/$csvFile", "w");
fwrite($fp, $data['reason']);
fclose($fp);
return '';
return TRUE;
}
What the above code does is write a csv file to the correct location for the '
notifications' table to read it as a list for the prov field. Since I do this with every field which has a list associated with it if there is a mistake or a missing items anyone with access to the correct table can go in and update any item or add to the list. The above code is for a single field. On those where I have multiple fields which need their items to be read from a csv file I use case statements to make sure only the correct one is written. (Another way is just to have a new csv file written for each field even if they were not changed.) If do it the first way to practice correct statement coding and to speed it up.
This has proved very handy in one app where various organizations have to get notified of a new report. They needed to select the report #. Not all reports could be shared by notification. So this method allowed them a very easy way to do this. The main person, after approving the report, if needed, then could add it to the list of those reports to show up in the list of reports. For example the list shows: AAC45T, AAC47T etc. Not all reports need to show up.
Hope this at least makes some sense.
Alan