Hi, In Opportunity/Quote Entry, what is the location of Subassembly Mtls in oTrans.EpiDataViews?
In dataview for [“JobMtl”] I’m only finding Mtls for AssemblySeq 0 and I need Mtls from AssemblySeq > 0
e.g. in the screen shot here, I need Mtl BJ79-55 to be available in a dataview.
Good question, as we only have single level MOMs. But I would think that the dataview gets updated when the tree view selection moves between assemblies, so the correct value is there when the correct object in the tree is selected (even the the tree is populated with everything when it’s rendered the first time)
Thanks @MikeGross I’ve tried some tests to align additional DV’s today without success (No Mtl BJ79-55 in output).
The only thing that working in this code is that it positions to the correct QuoteLine.
So I’m missing the needed DV (and/or have something wrong between QuoteDtl & JobMtl)
Can I ask what you are trying to accomplish? There are other methods (LINQ, Dynamic BAQ, etc.) to fetch some information for use elsewhere. Also, you could traverse the Treeview for the part# if that is all you need - there is a post on here somewhere…in fact it was your post I recall:
As for your code snip - I am certainly not skilled enough in the C# area to know exactly the issue, but I would suspect that you need to cause the dataview to refresh using the SEQ#=1 in order to get the JobMtl DV to contain what you need.
There are some much better code gurus here - maybe they’ll see this.
So I clicked on Mtl BJ79-55 in the Operation and then it was in my edvJobMtl1.
So that’s good.
I noticed that edvJobAsmbl1.Row == -1 after doing that.
What I’m trying to do is simulate that click via EpiDataView related code.
Anyone?
Hi Pierre @Hogardy
I saw this post from you and because of that I though you might be able to provide the names of the dataviews I need to align before I can get to AssemblySeq’s > 0 in datataview JobMtl.
Thanks to @josecgomez Trace Parser I can clearly see what happens when I click the Mtl as shown in the first screen shot of this post. However, I’m having a heck of a time trying to implement that in code.
In Approach 1, I didn’t find the dll’s for QuoteAsmImpl. Nor do I know exactly what the ?? parameters ?? should be. Therefore, I tried Approach 2.
In Approach 2, I’m getting Error: CS0246 - line 739 (2667) - The type or namespace name ‘QuoteAsmAdapter’ could not be found (are you missing a using directive or an assembly reference?)
When I have the references and the using Erp.Adapters;
I’m hoping I’m close to getting this to work, but currently stuck. Does either of the Approaches work for anyone?
What I’m trying to figure out now is how to get the JobMtl DataView to have this adapter data in it.
Since I know (as I’ve mentioned before) that when I click through the UI that
If I could do that then it should work with my grid that is bound like this
public void CreatePartCostBAQView()
{
baqPartCost = new BAQDataView("PartCost");
oTrans.Add("PartCostBAQ", baqPartCost);
string pubBinding = "JobMtl.PartNum";
IPublisher pub = oTrans.GetPublisher(pubBinding);
if (pub == null)
{
oTrans.PublishColumnChange(pubBinding, "MyCustomPublish");
pub = oTrans.GetPublisher(pubBinding);
}
if (pub != null)
baqPartCost.SubscribeToPublisher(pub.PublishName, "PartCost_PartNum");
}
Otherwise, I don’t know if could also bind to the adapter as well as JobMtl.PartNum (like you might if you were binding to multiple columns). I’m trying to avoid having another grid with a binding to the adapter. If that is even possible. Anyone?
I created a BAQ that I call with a dynamic query adapter passing QuoteNum and run once for each quote. It returns QuoteMtl_QuoteLine, AssemblySeq, MtlSeq and PartNum. I set a data table to this and that is my driver to loop through for my process.
While on each iteration, I check to see if the current AssemblySeq has changed from the previous one OR the QuoteLine has changed from the previous one. If so, reset a variable “mtlRowInSeq” back to 0.
So then for each iteration I call this (the 2nd assemblySeq is actually for CurrentAssemblySeq, but I keep both with the same value)
using (var quoteAsmAdapter = new Erp.Adapters.QuoteAsmAdapter(this.oTrans))
{
quoteAsmAdapter.BOConnect();
Boolean myBool = quoteAsmAdapter.GetDatasetForTree(quoteNum, quoteLine, assemblySeq, assemblySeq, ipCompleteTree);
var AsmRow = quoteAsmAdapter.QuoteAsmData.QuoteMtl.Rows[mtlRowInSeq];
// more logic for my process...
AsmRow["EstUnitCost"] = whatever;
// more logic for my process
++mtlRowInSeq;
prevAssemblySeq = assemblySeq;
prevQuoteLine = quoteLine;
AsmRow["RowMod"] = "U";
quoteAsmAdapter.Update();
//oTrans.Refresh(); Save this for when the loop ends
}
Additionally, my process needs to handle user interation while in the loop(s), so when that happens I just break out of the loop(s) and enter back in setting the loop initializer to where I left off.
So it all works great and it is very fast. I hope this helps someone out someday.
NOTE: At one point I tried going down the road of keeping track of the QuoteAsm NextPeer and Child returned from GetDataSetForTree, but that got ugly. What I came up with above takes much less code and is easily maintainable.
Also, I realize that I am pulling down the same Materials each time I call GetDataSetForTree with the same AssemblySeq as I loop through for each material sequence, but there is no performance problem and doesn’t seem worth it to code it different.
HI @josecgomez sorry to trouble you, but since I can’t edit my original post, as Admin can you replace the screenshot in the original post with the attached.
Thanks!