Can you post the entire scrip, including what's in the Sort Records script steps? I only see one End if, but 2 If's.
Also, I don't understand... I have two tables, both set up the same way......applying a script to each column header...
Are you talking about columns in a portal? Which TO is the portal based on, and how are they related to each of the 2 tables.
If it's dynamic column sorting, this works great for me:
Sounds like you are sorting records on a field from the wrong table occurrence for the layout that is current at the time the records sort.
Basically I made a button over each field that runs my script. I didn't post the whole script because sort records isnt very descriptive on what you specify as the target. I have checked many times that I have the proper fields and tables selected in the sort records step. Another thing, this is not a portal. They are just multiple fields arranged side by side and in list view to give the appearance of a table.