How to access the material part number from the tree using the c# editor in Configurator Rules

I am trying to access the material part number from the currently selected tree node in Configurator Rules. I can see no out of the box way to do this in c#. This info is stored in a dataView when I look at my debug console. The info I need seems to stored in the ‘RulesMtlView’ dataView under the ‘MtlPartNum’ column. I know how to retrieve dataView data from the client using JavaScript. I need to use that material part number inside my ‘keep when’ rules and other places inside rules without having to manually supply that number. Is there a way to access dataviews like shown below but using c#? I have also looked at swagger to find something. There is a ‘Erp.BO.ConfiguratorRuleSvc’ but since the data is already in memory there isn’t a REST call when I click on different nodes.

DataView data from JavaScript
trans.dataView(VIEW_NAME).viewData

Access selected row binding from JavaSscript
{VIEW_NAME.COLUMN_NAME}

screenCast

While searching for some clues on how to access a data view in the browser from c# I found a post that I made from a few months ago asking a similar question without feed back. I feel like this should be easy but I haven’t found anything yet.

Hi James,

I realize you may already have a solution for this, but I just saw your post and wanted to offer this, since there was no response.

Keep in mind that that the tree node view you are looking at is a design-time visualization. When the Configurator Rules are run, this always happens at run-time, and more specifically on the server, not the client. Which means this view is not available.

You may be able to accomplish your goals with some variation of the following.

string thisPartNum = string.Empty;
switch (Context.Entity) 
{
	case "QuoteAsm": thisPartNum = QuoteAsm.PartNum; break;
	case "QuoteMtl": thisPartNum = QuoteMtl.PartNum; break;
	case "JobAsmbl": thisPartNum = JobAsmbl.PartNum; break;
	case "JobMtl": thisPartNum = JobMtl.PartNum; break;
	case "ECOMtl": thisPartNum = ECOMtl.MtlPartNum; break;
}

string[] results = UDMethods.GetPartNumberAndQty(thisPartNum);
decimal QtyPer = Convert.ToDecimal(results[1]);

switch (Context.Entity) 
{
	case "QuoteAsm":  break;
	case "QuoteMtl":  QuoteMtl.QtyPer = QtyPer; SetPartDefaults(); break;
	case "JobAsmbl":  break;
	case "JobMtl":  break;
	case "ECOMtl":  break;
}