How to fetch a particular datafield 's value from every Docname?

For an instance: I want to compare an item_Group in sales order with item group in the list of pricing rules . how can i compare it with the client script?, any help would be appriciated