Syntax for derived values in command

The line with the derived klantnm works fine in application, but gives an error in command and in update.
The auto increment doesn’t work either, I still have to give in a number
what would be the correct syntax?

		'Aanvrager': stategroup (
			'Relatie' {
				'KlantNr': text -> ^ ^ .'Relaties'[] where 'RelatieType' -> $ .'RelatieType'?'Debiteur'              
				'KlantNm': text = >'KlantNr'.'Naam'
			'Prospect' {
				'klantNr': text = "0"
				'klantNm': text

	'Nieuwe Calculatie': command {
		'calculatie': text @default: auto-increment
		'naam aanvrager': stategroup (
			'klant' {
				'klantnr': text -> .'Relaties'[] where 'RelatieType' -> $ .'RelatieType'?'Debiteur'
//				'klantnm': text = $ >'klantnr'.'Naam'
			'prospect' {
				'klantNr': text //= "0"
				'klantNm': text

			'Aanvrager' = switch @ .'naam aanvrager' (
				|'klant' as $ => create 'Relatie' (
					'KlantNr' = $ .'klantnr'
//					'KlantNm' = >'KlantNr'.'klantnm'  
				|'prospect' as $ => create 'Prospect' (
					'klantNm' = $ .'klantNm'

The application language does not support derived values as arguments to a command or action. Do you have a use case for that? For showing the Naam of a Relaties item after selecting one, you can use this:

'klantnr': text -> .'Relaties'[] as $ 
    where 'RelatieType' -> $ .'RelatieType'?'Debiteur'
    @show: ( 'Naam': text )

As for auto-increment, that is meant for a property that is instantiated multiple times. For example, for a collection of Calculations:

'Calculations': collection ['Calculation'] {
	'Calculation': text @default: auto-increment || "01"

If you turn Nieuwe Calculatie into an action, then the code above will provide the number. You do not have to set the key Calculation in the action implementation. For commands, the language does not support auto-increment: it is a GUI annotation, as @default indicates. We are considering supporting that in a different manner.

If a command is required for your specific use case, you can use a guid instead:

'calculatie': text @default: guid

Thanks for the info, after I’ve changed the code there was no case for that anymore, but I had to check to be sure.