Copy/paste scripts of this sort are not the best option. Copy will destroy any data the user has previously copied to the clipboard and this can be both confusing and annoying to the user. It is also easily avoided.
In addition, both copy and paste will fail to work if the fields they reference are not present on the current layout with field access permitted while in browse mode. If the field is not present on the layout or access to the field in browse is not allowed, no error messages pop up but the script step fails to copy or paste data. Script steps that start with "insert" also have this limitation.
For that reason, set field or set variable, then set field is a better option for moving data from one place to another.
I'm not sure about your script example though. What kind of field is "benefits for Task Report"? is it a number or other data field or is it a summary field? A calculation field?
Benefit for Task Report is a calculation field:
Task Net n Tax n ER Cost Total Sum- Med Sum - Dent Sum - FSA Sum - K Plan Sum
Your solution worked great for this filed however,
it won’t work for this other calc field:
Benefits for Task Report - EE ER Tax::PayChex Total
However, I just added an additional calf field based on the new set field.
Still just curious for future use why it would work for one and not another.
There is not enough detail in your post to suggest an answer.
Set field, like any other script step depends on the current table occurrence "context" to determine what happens when it is executed. That context is established by the layout's specified table occurrence in Layout Setup... | "Show Records From".
You also have not indicated HOW it didn't work--which might provide a clue as to why it didn't work.
I am assuming set field does not work when using data from another table.
The filed it is acquiring from is
Benefits for Task Report - EE ER Tax::PayChex Total (this EE part coming from another table)
I resolved it by just recalculating it in another field.
As far as your reply that it is better to use Set field vs copy paste,
How would one copy data from one record (go to last record) and paste it to another record (go to previous record).
Does not seem possible with the set field setup.
If you read my initial post again, I said to use set field OR set variable and set field.
Set Variable [$Value ; Table::Field]
Then your script can change records or use go to layout to change tables.
Set Field [Table::Field ; $Value ]
Think of Set Variable as your "copy" and Set field as your "Paste"
Though if the proper relationship exists, set field can do both the "copy" and the "paste" in one step:
IF you have:
Then from a layout based on Table1
Set Field [Table2::field ; Table1::field]
copies a value from the current Table1 record to the FIRST related record in Table 2. If there are more than one such related records, only the "first" is modified by this script step. In fact, if "allow creation..." is enabled in the relationship, this step can be used to create a new related record in Table 2 much like entering data in a portal to table 2 could create a new related record.