Skip to content

Instantly share code, notes, and snippets.

@ztirom
Last active September 30, 2017 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ztirom/3d310e869bb334f4387963b5ec587510 to your computer and use it in GitHub Desktop.
Save ztirom/3d310e869bb334f4387963b5ec587510 to your computer and use it in GitHub Desktop.
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