add to list if not already there

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
magicalmutation
Posts: 11
Joined: 2013-08-07 17:15

add to list if not already there

Post by magicalmutation » 2013-12-11 12:01

ok,
so you have a list and you pull down but the option you want is not there..
how about being able to type in an item so say for instance days of week it listed Monday, Tuesday, Wednesday, Thursday, Saturday, Sunday
you could just add Friday without having to leave the current page... just a thought..

would speed things up for me

thanks for the good work 8-)

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: add to list if not already there

Post by KSan » 2013-12-25 02:47

I recall Ahmad indicating that this would be implemented soon. Fingers crossed.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: add to list if not already there

Post by shasta59 » 2014-02-01 01:22

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
Calgary, Alberta, Canada - Using Appgini 5.50 -

magicalmutation
Posts: 11
Joined: 2013-08-07 17:15

Re: add to list if not already there

Post by magicalmutation » 2014-03-17 12:39

hmmm good idea... (sorry for the late reply)

but i do things a little different. instead of using a list i create another record. so for instance..

i have field called towns in the address record.
this looks its data from the towns record and the town name is taken for this field.

so if i have a new town i can either add them in the database by going to the towns record and adding new town names.
but what i wanted was to be able to add them if they dont exist. but i like the idea of the csv file. the only thing is a csv file could get rather large if it was something other than towns and was say for instance client names...

yes i know its a bit lazy but would be very slick.

then again my new problem of the child records not updating is driving me so nuts i have not had time to look at this yet.

benzoD
Veteran Member
Posts: 69
Joined: 2013-01-31 21:16

Re: add to list if not already there

Post by benzoD » 2014-04-29 20:30

I just wanted to say thanks to shasta for this easy method for non-server admins to add options to the drop downs. Some users asked for this recently and I was able to help them with these simple instructions. :)

toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29

Options List - Add new option (from application window)

Post by toconnell » 2018-10-05 18:31

Was the ability to add a new option from an options list from the application that was output, directly, not in a CSV.. has this ever added to AppGini?

I need the option to add new if not in the list from the application by the user and need permissions to control access to do that. Not from a separate spreadsheet wont work with permissions. is there an ADD new feature? Ahmad?

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: add to list if not already there

Post by pböttcher » 2018-10-06 07:54

Hi,

why do you have constraints with the permission on the server for the csv file? Your user should have no access, or?

I think the current ability to modify the list-options is only via the csv file in AppGini.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply