Skip to content

Instantly share code, notes, and snippets.

@setap
Created January 30, 2015 13:55
Show Gist options
  • Select an option

  • Save setap/0b3886fd8ae95f8f37a1 to your computer and use it in GitHub Desktop.

Select an option

Save setap/0b3886fd8ae95f8f37a1 to your computer and use it in GitHub Desktop.
Загрузка подразделений.
function iterate() {
var dept = new SCFile("dept");
var ret = dept.doSelect("true");
while (ret == RC_SUCCESS) {
R(dept);
ret = dept.getNext();
}
}
function R(record) {
if (record.atc_parent_id != "10000359") {
var file = new SCFile("dept");
file.doSelect("dept.id=\"" + record.atc_parent_id + "\"");
R(file);
var parenName;
if (file.parent == null) {
parentName = file.dept_name;
print(file.dept_name);
} else {
parentName = file.parent + "/" + file.dept_name;
}
record.parent = parentName;
record.doAction("save");
// fill(record);
}
}
iterate();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment