Hi sriraag,
Its simple to get, if you want to get the name based on id text boxes. put the function like this in the text box value.
Double click the text box, click function (fx) button in beside the value text box -> click InsertFieldOrGroup -> select the name field in the secondary data source and click 'filter data..' button below it and make a condition like this.
id in secondary source is equal to combolist field in the main data source after that enter ok buttons and preview your form, you will get the name.
How ever you know how to get the id.
Hope this will help you.
B.Shiva Prasad
InfoPath Dev,
http://www.ggktech.com
India