I am trying to populate a text box with the Value from a Query of a BAQ. I want to fill in the below box with a calculated field of stdcost from the part cost table. I have watched a couple things to get to the point I am at now, but I am getting the the error below the code. I think that this is the easiest way to populate that field but i am having issues.
I assume your EpiNumericEditor is named “PartCost”. This will need to have its “Value” property set.
Also, you are trying to put the entire table from the query in the EpiNumericEditor. You have to select a single row (even if there is only one) and a single column (even if there is only one).
I m having an issue with the code I have so far. Now I am trying to make a variable and compare it to the BAQ query value I have. It works for the first go through, If the value is greater then show message, but then they change the vlaue to make it false, and the message box shows still, i think it is because it is getting the stored field from the DB, so I might be getting the value for UnitCost in the wrong location. Maybe I got to deep into the rabbit hole. Code is below.
UnitCost is set to ScrUnitCost which is a database field, It takes that change and I am guessing writes to the Database. if that value is greater then the PartCost.Value, I want it to show a message, which it does with the nested if statement. The issue is that if I go in and change that ScrUnitCost < PartCost, then the unit cost goes out to the Database and gets unitscost = scrunitcost from the database, but it is still the old value which is greater then StdCost so the message shows even though the new price is lower. That is the best I can explain the error, I am probably taking the long way around or doing it the hard way.
No the standard cost i am pulling in from the query of the BAQ that I am bring in and just displaying that for the buyer to reference. If the purchase price is more then the standard cost we have listed, a warning should appear to alert them that they are paying more. that part is working as it should.
So the std cost stays the same and you are changing the purchase cost on the screen, it should be able to compare the two properly.
As a warning for your code, you are executing the BAQ every time any field changes…
That BAQ is only bringing back a calculated field, and just for that one part, I don’t think it will impact the system to much, but, will this impact during PO suggestions?