Update collections using a command


In my application I have 4 groups, which each have a collection, like this example:

'Automotive Union': group {

		'Data Automotive Union ': collection ['id'] {
			'id': text
			'First name': text
			'Last name': text

I want to make a command in the application that is able to update the collections. However, the collections all have different types of data. Is it possible to choose the collection to update data for in the command, and then fill in the right data?

Right now the only way I can get the command to work is by placing the name of the collection directly in the code like this:

} as $'param' => update ^ .'Data Automotive Union' = create (

Can this also be done depending on user input in the command?

Thanks in advance!

You could do something like this:

'create item': command {
	'Target': stategroup (
		'Data Automotive Union' {
} as $'param' => switch $'param'.'Target' (
	|'Data Automotive Union' as $'d' => update ^ .'Data Automotive Union' = create ( ... )

However, if the commands only add items to the collections, you should consider letting the user just use the Add buttons that are available by default. Also, using an action instead of a command may help you reach your goal faster.