Using link action code to add attribute values from destination to origin

I am organising my courses this semester in Tinderbox (so far quite successfully). I am using a link type ‘Participant’ to connect students to seminar containers (origin: student, destination: seminar container).

The pSeminar prototypes have a string type attribute $cCourse to indicate the specific course name.

I also have set up a set type attribute $sSeminar in the pStudent prototype as the name of the course ($cCourse) is unique while $sSeminar could contain more than one value as I could teach the same students in different seminars.[1]

I am trying to automatically copy the value from $cCourse (destination) to $sSeminar (origin) via link action code but get no results. I blame my lack of understanding a) action code and/or b) the relation between string to set type attributes. I know the fundamentals of these types, what set and string types do and for what purpose, but I couldn’t find information on how they can be ‘combined’.

tldr;

  • pStudent (origin): set type attribute $sSeminar
  • pSeminar (desintation): string type attribute $cCourse
  • task: adding value of $cCourse to $sSeminar via link action code (type “Participant”)

So far my (simple) action code for the link looks like this: $sSeminar=$sSeminar+$cCourse;

I suspect it has something to do with the different attribute types and how I try to connect them. I am sure double quotes are the wrong approach (hence I didn’t try that). Yet, using square brackets gave me the same results that I expected from using double quotes. In the aTbRef to set attributes I could find much helpful information for other cases but unfortunately nothing that covers this use case.

I appreciate any hints to the right direction :slight_smile:

PS: I still need to delve into my other project but didn’t have capacities for it. Yet, I am still grateful for the help you provided and I am looking forward to learn more about TBX and someday also be able to provide sth. for the forum.


  1. It could be debated, if it would make more sense to name the attributes $cCourse and $sCourse but this is something I need to consider for later :slight_smile: ↩︎

ouch! While I was editing my post I found the error myself! I simply forgot after tinkering with the code to add (destination) to $cCourse again. Now the code $sSeminar=$sSeminar+$cCourse(destination); works as expected. Still, hopefully this use case inspires others to use link action code to manage attributes.

2 Likes