What you have going on in that Key Schedule shouldn't even be possible.
A Key Schedule has a key that a user would select (from a list of all of the entries that you add to the Key Schedule), then it has other fields that will be filled in according to the values that you enter into the schedule on that Key Row. You then create rows that consist of the keys that the user will select from and values for each of the fields that you have added to the schedule.
You seem to have somehow created a Key Schedule in which you select a key and it tries to set the value of itself based upon your selection...
The Key itself should always be a text field. You can then have another field(s) that references another parameter that you want to set based upon a user selecting that key.
Take a look at the attached file for a reference. When you select the "Lining Selection" Key, it will then set the NOTES?DETAILS parameter to a predefined field and it will set a new "Test Window Type" field that I have added. Since that new field is a Type selector it will be an Element ID field. It will display to the user as the Family Type name that is tied to that Element ID.
To add rows programmatically you should now be able to dig into the available types of that Category and assign the Element ID of the desired type, which will then be displayed as the type name to the user.
See what happens and how it works with my modified sample. Hopefully it will get you headed in the right direction.
-G