I have a button bars with a calculation to show the number of my expired materials I have the following below step scripts that attached to each to go to the related record, I don't know if my script is correct or the sequence is correct, my Refresh Object is not also working, because if the calculated result is 0, I clicked on it, still highlighted even there is a refresh object in my script.
Set Error Capture [on]
If [Get (ScriptParameter) = "Materials Expiring Today"
Go to Related Record [Show only related records; From table: "Materials_Expiring Today" ; Using layout: "Materials" ( Materials)
If [Get (Foundcount) = 0]
Show Custom Dialog ["No records" ; "No records where found."]
Refresh Object [Object Name: "Materials Expiring Today"]