Custom script to set parent table value

This may be helpful: