JanKjeldsen

columnMap

Dec 5th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public static Map columnMap(container fields, container mandatory = conNull())
  2. {
  3. int i;
  4. int n = conLen(fields);
  5. Map ret = new Map(Types::String, Types::Integer);
  6. for (i = 1; i <= n; i++)
  7. ret.insert(conPeek(fields,i), i);
  8. n = conLen(mandatory);
  9. for (i = 1; i <= n; i++)
  10. if (!ret.exists(conPeek(mandatory,i)))
  11. throw error(strFmt("@SYS26332", conPeek(mandatory,i)));
  12. return ret;
  13. }
  14. str getField(str name)
  15. {
  16. return conPeek(rec, map.lookup(name));
  17. }
Add Comment
Please, Sign In to add comment