Try to exchange PartRev.Column with myFKVTable and do:
EpiDataView myFKV; //in custom variables
DataTable myFKVTable;
//in init
myFKV = oTrans.Factory("Name of your FKV");
myFKVTable = myFKV.dataView.Table;
//now you should be able to substitute as mentioned above
Error: CS1061 - line 50 (371) - 'Script' does not contain a definition for 'myFKVTable_Column' and no extension method 'myFKVTable_Column' accepting a first argument of type 'Script' could be found (are you missing a using directive or an assembly reference?)
Error: CS1061 - line 50 (371) - 'Script' does not contain a definition for 'PartRev_AfterFieldChange' and no extension method 'PartRev_AfterFieldChange' accepting a first argument of type 'Script' could be found (are you missing a using directive or an assembly reference?)
Error: CS1061 - line 63 (384) - 'Script' does not contain a definition for 'myFKVTable_Column' and no extension method 'myFKVTable_Column' accepting a first argument of type 'Script' could be found (are you missing a using directive or an assembly reference?)
Error: CS1061 - line 63 (384) - 'Script' does not contain a definition for 'PartRev_AfterFieldChange' and no extension method 'PartRev_AfterFieldChange' accepting a first argument of type 'Script' could be found (are you missing a using directive or an assembly reference?)
Code:
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
EpiDataView myFKV;
DataTable myFKVTable;
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
myFKV = oTrans.Factory("Part");
myFKVTable = myFKV.dataView.Table;
this.myFKVTable_Column.ColumnChanged += new DataColumnChangeEventHandler(this.PartRev_AfterFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.myFKVTable_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.PartRev_AfterFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void myFKVTable_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "Approved":
MessageBox.Show("TEST");
break;
}
}
}
To get to PartRev, I had to go to OrderDtl and create an FKV for Part, and then I created a STV on Part that linked to OrderDtl to get the revision number.
U know maybe I’ve taken you too far down the rabbit hole. How about you just place a change event on the row of the order detail (which would change the PN and ultimately drive the STV change) - inside of it, we’d just look up your value:
Lol - I’ll get you there eventually. Do the same thing in an AfterField change on the OrderDtl.RevisionNum field By golly if that dont work we’ll hook directly to the damn control
Something happens now! Strangely, the message box shows the opposite of what it should say. I’ve now changed it over to an EpiShape. If I select an unapproved revision, the color changes to yellow, but when I select an approved revision, it stays yellow. Then when I select an unapproved revision, it changes to green. It seems like it’s changing to the color that corresponds to the previous selection. I’ll try switching up the if statement.
Also, the title in EpiShape is not changing accordingly…
As for the second part of my comment…I thought the properties of the EpiShape determe the caption (enabled vs disabled)…that’s not what I was looking for. There must be a property of EpiShape that changes that.
I ended up going back to the checkbox bound to STV_PartRev.Approved, then created an event for when the custom checkbox gets checked or unchecked. I then put an if statement in the event handler that changes the color and caption for the epiShape.