Selectrelated, key and sourcekey options not working

The following line of code is failing to select the target record:

selectrelated "Contacts Database","key",{«Contact ID»},"sourcekey",{«Contact ID»}

Instead of using the specified key and source key, the statement is selecting the records based on the main key defined in the Relations Panel, so the override for the key is not working.

For reference, the key override is working as expected with the Join statement.

join "Contacts Database","key",{«Contact ID»},"sourcekey",{«Contact ID»}

Am I missing something?

You’ve encountered a previously undiscovered bug. When using the selectrelated statment (and also selectrecordsrelatedto) the options are not case insensitive - they will only work if all upper case. I’ve fixed this for the next release, but if you want to get your code working immediately, change "key" to "KEY" and "sourcekey" to "SOURCEKEY".

Thank you Jim, Upper case for the options resolved the problem.