web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :

List all mandatory fields in the AOT Job

Fawad Hassan Profile Picture Fawad Hassan 337

Hi-

I wrote a job today that can list all the fields that are mandatory and belongs to particular tables that have particular configuration key. I thought I should share the code here, it might be helpful.

#static void findMandFIelds(Args _args)

#{

# Dictionary dictionary;

# TableId tableId;

# Dicttable dictTable;

# DictField dictField;

# int fieldCounter;

# TextBuffer textbuffer = new TextBuffer();

# str fieldpath, previousText;

#

#

# dictionary = new Dictionary();

#

# tableId = dictionary.tableNext(0);

#

# while (tableId)

# {

# info(int2str(tableId));

#

# tableId = dictionary.tableNext(tableId);

# dictTable = new DictTable(tableId);

#

# if (dicttable && dictTable.configurationKeyId() == configurationKeyNum(‘Bank’))

# {

# fieldpath = “”;

# for (fieldcounter = 1; fieldcounter <= dictTable.fieldCnt(); fieldCounter++)

# {

# dictField = new dictField(tableId, dictfield.fieldCnt2Id(fieldCounter));

# if (dictField && dictField.mandatory() == true)

# {

# fieldpath += dicttable.name() + “:”+ dictField.name() + “\n”;

# }

# }

# previousText = textbuffer.getText();

# textbuffer.setText(previousText + fieldpath);

# }

# }

 

# textbuffer.toFile(“c:\\Test.txt”);

#}



This was originally posted here.

Comments

*This post is locked for comments