mapData function created instead of sql in the script