If the file name doesn't depend on anything in the data, then I would use a Script Task in the control flow rather than a Script Component in the data flow to set the value.
If the file name does depend on something in the data, a Script Component is probably the best way to get that information; however, the Script Component cannot update any ReadWrite
variables outside of the PostExecute
method (which will not happen until all the input rows have been processed); this means that the variable changes will not be reflected in the output file's name. In this case, I'd suggest using a File System Task to rename the file after the data flow completes.