Button Problem with a Table

I feel certain that I have missed something obvious but this has me stumped so…

I am tracking several individuals playing a game. There is a tiddler for each player’s scores in fields designated score01, score02, etc. Frequently, a player’s score hasn’t changed between the recording points, and I currently have to copy the entry to the next field manually. I have been trying to create a button that, when clicked, would copy the entry to the next field.

The field I am copying and where I am copying the value to change, as time passes.

So far, every attempt I have made has failed. The heart of the problem seems to be in this subroutine, which shows my latest attempt:

\define copy-field()
<$wikify name="targetfield" text='{{Table Display!!field1}}' >
<$wikify name="newvalue" text='{{!!{{Table Display!!field2}}}}' >
<$button>
<$action-setfield $field=<<targetfield>> $value=<<newvalue>> />
<<newvalue>> to <<targetfield>>
</$button>
</$wikify>
</$wikify>
\end

The new value and the target field show correctly on the button, but what gets placed in the target field if something like {{!!score02}} rather than the value.

If you need a fuller picture of what I am doing you can find the full wiki at https://tableproblem.tiddlyhost.com/

Can someone tell me what I am doing wrong?

Hello @Stephen_Kimmel,
I have seen something that may be useful to you but I’m not sure if it is what you want.
Please have a look at @telumire’s site example here

You can’t have quotes around the text to wikify:

text='{{Table Display!!field1}}'

should be

text={{Table Display!!field1}}

You also cannot nest brackets, {{ inside of another set of {{

Not sure I am understanding completely. In this case you are trying to get the field whos name is stored in field1 of the Table Display Tiddler and the field whos name is stored in field2 of the same Table Display Tiddler, and then, put the value that is stored in the field that was in field2 into the field that was stored in field1, but in the current tiddler or the same Table Display tiddler? The reason for the confusion is that, although incorrect, you display {{!!{{Table Display!!field2}}}}, and the {{!! at the begining denotes the current tiddler and not the Table Display tiddler.

I know that sounds confusing, so again, not sure I am certain of what is going on here. If I am right, try this. Again, my way of going about it might be completely wrong, and others will correct me or show an easier way. Or I could just be completely wrong with my understanding of your problem and my approach. If all of this is being done in the Table Display, then replace [all[current]get] with [[Table Display]get] and add $tiddler=“Table Display” to the <$action-setfield

<$let targetfield={{Table Display!!field1}} field2value={{Table Display!!field2}} newvalue={{{ [all[current]get<field2value>] }}}
<$action-setfield $field=<<targetfield>> $value=<<newvalue>> />
<<newvalue>> to <<targetfield>>
</$let>

Perhaps this will help:

The representation of <<newvalue>> is identical in the button function as it is in the action-setfield function. In the case of ‘Pam’ I wanted the value 2695 which was in the Pam tiddler in field score02 to be copied into the Pam tiddler field score03. <<newvalue>> shows as 2695 on the button, which is correct, but what got placed in the field score03 was {{!!score02}} which is not what I wanted.

I don’t understand why they are different. If '{{!!{{ was illegal in the wikify statement, why did it show correctly in the button statement?

<$action-setfield $field=<<targetfield>> $value=<<newvalue>> />
<<newvalue>> to <<targetfield>>
</$button>```