Dynamics NAV 2016 Purchase Invoice Line Dimension Defaults



I'm trying to figure out how the default dimensions are set when I put a line into Purchase Invoice screen? I noticed when I select a No. then go to Line Dimensions, I have two default dimensions. I understand this is kept in Dimension Set Entry table, but how does it know what ID to select for the line? Is it determined via the No. of the line? Or Buy from Vendor No. in the header? I'm trying to do a sql statement to get the dimensions via the dimension set ID, but the missing link to how it determines this I'm confused, tried a profile trace, but I can't seem to understand how it works.


thank you