Skip to content

Instantly share code, notes, and snippets.

@ztirom
Last active Sep 30, 2017
Embed
What would you like to do?
Table Extension2
class TestMyExtension
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
InventTable invenTable = InventTable::find("1000" /* ItemId */, true /* Select For Update */);
if (invenTable)
{
TestMyExtension::InsertMyText(invenTable, "FillMyExtension");
if (TestMyExtension::CheckIfFieldIsEmpty(invenTable))
{
info("Empty!");
}
else
{
info("Is filled!");
}
}
}
public static void InsertMyText(InventTable _invenTable, str _myExtText)
{
try
{
ttsbegin;
_invenTable.MyExtField = _myExtText;
if (_invenTable.validateWrite())
{
_invenTable.update();
}
else
{
throw Exception::Error;
}
ttscommit;
}
catch
{
error(":/");
}
}
public static boolean CheckIfFieldIsEmpty(InventTable _invenTable)
{
return InventTable::isMyFieldEmpty(_invenTable);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment