Change EpiShape status based on approved revision

The code compiles…but nothing happens when I change the revision in the dropdown.

private void OrderDtl_AfterRowChange(EpiRowChangedArgs args)
{
	// ** Argument Properties and Uses **
	// args.CurrentView.dataView[args.CurrentRow]["FieldName"]
	// args.LastRow, args.CurrentRow, args.CurrentView
	// Add Event Handler Code
	EpiDataView mySTV;
	mySTV = oTrans.Factory("PartRev");
	bool myVal = (bool)mySTV.dataView[mySTV.Row]["Approved"];
	if (myVal == true)
	{
		MessageBox.Show("APPROVED");
	}
	else
	{
		MessageBox.Show("NOT APPROVED");
	}
}

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 :smiley:

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.

Okay…I’m not sure what’s going on now. Even when I swapped the if statement, some unapproved revisions are showing up green.

I had my own learning curve with EpiShape:

I actually found that thread before, that’s how I learned about the Status.

It looks like the color is reflecting the approval status of the previously selected revision.

i was afraid of that. That’s firing before the subtable is being updated.

We need to get that event firing on the STV itself

When I change it to PartRev, I get the errors described previously.

Sticking with OrderDtl for the trigger, could there be a way to force updating the subtable view before running the if statement?

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.

private void epiCheckBoxC1_CheckedChanged(object sender, System.EventArgs args)
{
	// ** Place Event Handling Code Here **
	bool myVal = epiCheckBoxC1.Checked;
	if (myVal == true)
	{
		epiShapeC1.Status = StatusTypes.OK;
		epiShapeC1.EnabledCaption = "Approved";
	}
	else
	{
		epiShapeC1.Status = StatusTypes.Warning;
		epiShapeC1.EnabledCaption = "Not Approved";
	}	
}
1 Like