How to create Table fields using X++ Code

Step 1. First create table using the above code

Step 2. Now you can create field for your Existing Table. So write this Code

CODE:

static void TableFieldAddTest(Args _args)

{

TreeNode treeNode;

AOTTableFieldList fieldList;

#AOT

treeNode = TreeNode::findNode(@’\\Data Dictionary\Tables\Johnkrish1\’);

fieldList = treeNode.AOTfindChild(‘fields’);

fieldList.addString(“StudentName”);

fieldList.addInteger(“Mark1”);

fieldList.addInteger(“Mark2”);

SqlDataDictionary::synchronize();

print “Fields Created”;

pause;

}

Step 3.Now Run the code then the fields will be created like the below Screen shoot

createTableFields

Yeah!!! Ur done….

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s