Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void searchAcrossTables(Args _args)
- {
- UtilIdElements utilIdElements;
- DictTable dictTable;
- DictField dictField;
- str selectStr;
- CommaIO commaIO;
- container buffer;
- int k;
- str filename = "V:\\Data\\itemId.csv";
- ;
- commaIO = new CommaIO(filename, 'W');
- while select utilIdElements
- where utilIdElements.recordType == UtilElementType::TableField &&
- utilIdElements.name like "*ItemId*" &&
- !(utilIdElements.name like "*mbsItemId*") &&
- !(utilIdElements.name like "*EmplItemId*") &&
- !(utilIdElements.name like "*ExternalItem*")
- {
- dictTable = new DictTable(utilIdElements.parentId);
- if (!dictTable.isMap() &&
- dictTable.name() != "KinUtItemRenameLog" &&
- dictTable.name() != "CustInvoiceTrans" &&
- dictTable.name() != "InventTable")
- {
- dictField = new DictField(utilIdElements.parentId, utilIdElements.id);
- if (dictField.baseType() == Types::String &&
- !(dictTable.name() == "mbsProductReferenceTable" && dictField.name() == "RefItemId"))
- {
- print (dictTable.name() + "." + dictField.name());
- selectStr = strfmt(@'container runBufJob()
- {
- %1 %1;
- InventTable inventTable;
- container values;
- ;
- while select %1
- where %1.%2 != ""
- notexists join inventTable
- where inventTable.ItemId == %1.%2
- {
- values += [["%1.%2", %1.%2, int642str(%1.RecId)]];
- }
- return values;
- }',
- tableid2name(utilIdElements.parentId),
- utilIdElements.name);
- buffer = runbuf(selectStr);
- for (k = 1; k <= conlen(buffer); k++)
- {
- commaIO.write(conpeek(buffer, k));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement