GetByID Boolean?

Hello I was wondering how GetByID bool is changed? I use it to search for a record right now and if there is a record it returns true but if their isn’t it doesn’t turn false. instead it says record not found? What needs to happen in order for GetByID to return false?

    test = aba.GetByID("MainBook", chart, "D", 2020, "", "CompCal", "Main");
SetColumnReadOnly("Actual_c", true);
MessageBox.Show("Testing to see if bool:" + test);
try
{

	if (test)
	{
		MessageBox.Show(test.ToString());
	}
	else
	{
		MessageBox.Show("I AM FALSE");
	}
}

catch
{
	MessageBox.Show("CATCH ME")
}

What it returns when it doesn’t find a record

image

Screenshot is in BL Tester but I get the same messagebox while debugging too.

So what exactly changes the value on GetByID?

It’s failing before you get to your try, If you want your code to keep working, you have to put the GetByID inside the try.


try
	{
		test = aba.GetByID("MainBook", chart, "D", 2020, "", "CompCal", "Main");
		SetColumnReadOnly("Actual_c", true);
	}
catch
	{
		SetColumnReadOnly("Actual_c", false);
	}
2 Likes