const path = require('path')

let FILTER_TEXT = ''

let appLoc = path.join(..._program.split('services')[0].split('/'))
const sessionStoragePath = path.resolve(__dirname, '..', '..', 'drive', 'files', appLoc, 'mock-storage')
const filterStore = path.resolve(sessionStoragePath, 'filter.txt')

let sasControlTableFileText = ''

if (_WEBIN_FILENAME1.includes('SASControlTable')) sasControlTableFileText = _WEBIN_FILEREF1.toString()

if (sasControlTableFileText.includes('1,WEB')) { //it is filter_pk = 1
    try {
        FILTER_TEXT = fs.readFileSync(filterStore, {encoding:'utf8'}).toString()
    } catch (err) {

    }
}


function makeRows(n) {
    const dropdowns = ["Option 1", "Option 2", "Option 3"]
    const hardselects = ["Alpha", "Bravo", "Charlie"]
    // SOME_NUM is a HARDSELECT_HOOK column — values must come from the dynamic
    // validation service (editors/getdynamiccolvals.js -> `other`). Use a subset
    // of those valid values so the cells pass validation.
    const someNumValues = [
        0.00105564761956, 0.00521895988156, 0.0058409725343, 0.00613050395908,
        0.01305025071513, 0.01442142483518, 0.02422838845487, 0.0256445333481,
        0.02624525922641, 0.02891322459509, 0.02972866503043, 0.03103561933666,
        0.03150132113671, 0.03522355064527, 0.03529406247441, 0.03975785711768,
        0.04319973664507, 0.04521169189606, 0.04787342951068, 0.04948144222119
    ]
    const rows = []
    for (let i = 0; i < n; i++) {
        rows.push({
            _____DELETE__THIS__RECORD_____: "No",
            PRIMARY_KEY_FIELD: i,
            SOME_CHAR: "dummy data row " + i,
            SOME_DROPDOWN: dropdowns[i % dropdowns.length],
            SOME_HARDSELECT: hardselects[i % hardselects.length],
            SOME_NUM: someNumValues[i % someNumValues.length],
            SOME_DATE: "1960-02-12",
            SOME_DATETIME: "1960-01-01 00:00:42",
            SOME_TIME: "00:00:42",
            SOME_SHORTNUM: (i % 99) + 1,
            SOME_BESTNUM: (i % 90) + 10,
            // demo columns for the newer DQ rule types
            READONLY_COL: "Readonly default",
            HIDDEN_COL: "Hidden default",
            ROUND_COL: Number((i + 1 + i / 7).toFixed(5)), // rounds on edit
            NUMFMT_COL: 1000 + i * 12.5                     // shown as EUR
        })
    }
    return rows
}

let webouts = {
    MPE_X_TEST: {
        SYSDATE: "26SEP22",
        SYSTIME: "08:30",
        approvers: [
            { PERSONNAME: "sasdemo", EMAIL: "sasdemo", USERID: "sasdemo" }
        ],
        cols: [
            {
                NAME: "PRIMARY_KEY_FIELD",
                VARNUM: 1,
                LABEL: "PRIMARY_KEY_FIELD",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_BESTNUM",
                VARNUM: 9,
                LABEL: "SOME_BESTNUM",
                FMTNAME: "BEST",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_CHAR",
                VARNUM: 2,
                LABEL: "SOME_CHAR",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_DATE",
                VARNUM: 5,
                LABEL: "SOME_DATE",
                FMTNAME: "DATE",
                DDTYPE: "DATE",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_DATETIME",
                VARNUM: 6,
                LABEL: "SOME_DATETIME",
                FMTNAME: "DATETIME",
                DDTYPE: "DATETIME",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_DROPDOWN",
                VARNUM: 3,
                LABEL: "SOME_DROPDOWN",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_HARDSELECT",
                VARNUM: 10,
                LABEL: "SOME_HARDSELECT",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_NUM",
                VARNUM: 4,
                LABEL: "SOME_NUM",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_SHORTNUM",
                VARNUM: 8,
                LABEL: "SOME_SHORTNUM",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SOME_TIME",
                VARNUM: 7,
                LABEL: "SOME_TIME",
                FMTNAME: "TIME",
                DDTYPE: "TIME",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "READONLY_COL",
                VARNUM: 11,
                LABEL: "READONLY_COL",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "Read-only: default value inserted on add-row, not editable",
                LONGDESC: ""
            },
            {
                NAME: "HIDDEN_COL",
                VARNUM: 12,
                LABEL: "HIDDEN_COL",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "Hidden: invisible in grid but submitted; default on add-row",
                LONGDESC: ""
            },
            {
                NAME: "ROUND_COL",
                VARNUM: 13,
                LABEL: "ROUND_COL",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "Round: edited values rounded Excel-style to 2 decimals",
                LONGDESC: ""
            },
            {
                NAME: "NUMFMT_COL",
                VARNUM: 14,
                LABEL: "NUMFMT_COL",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "Number format: displayed as EUR currency (value unchanged)",
                LONGDESC: ""
            }
        ],
        dqdata: [
            { BASE_COL: "SOME_DROPDOWN", RULE_VALUE: "SOME_DROPDOWN", RULE_DATA: "Option 1", SELECTBOX_ORDER: 1 },
            { BASE_COL: "SOME_DROPDOWN", RULE_VALUE: "SOME_DROPDOWN", RULE_DATA: "Option 2", SELECTBOX_ORDER: 2 },
            { BASE_COL: "SOME_DROPDOWN", RULE_VALUE: "SOME_DROPDOWN", RULE_DATA: "Option 3", SELECTBOX_ORDER: 2 },
            {
                BASE_COL: "SOME_DROPDOWN",
                RULE_VALUE: "SOME_DROPDOWN",
                RULE_DATA: "This is a long option. This option is very long. It is optional, though.",
                SELECTBOX_ORDER: 3
            },
            { BASE_COL: "SOME_HARDSELECT", RULE_VALUE: "SOME_HARDSELECT", RULE_DATA: "Alpha", SELECTBOX_ORDER: 1 },
            { BASE_COL: "SOME_HARDSELECT", RULE_VALUE: "SOME_HARDSELECT", RULE_DATA: "Bravo", SELECTBOX_ORDER: 2 },
            { BASE_COL: "SOME_HARDSELECT", RULE_VALUE: "SOME_HARDSELECT", RULE_DATA: "Charlie", SELECTBOX_ORDER: 3 }
        ],
        dqrules: [
            { BASE_COL: "PRIMARY_KEY_FIELD", RULE_TYPE: "NOTNULL", RULE_VALUE: "" },
            { BASE_COL: "SOME_NUM", RULE_TYPE: "HARDSELECT_HOOK", RULE_VALUE: "services/validations/mpe_x_test.some_num" },
            { BASE_COL: "SOME_HARDSELECT", RULE_TYPE: "HARDSELECT", RULE_VALUE: "" },
            { BASE_COL: "READONLY_COL", RULE_TYPE: "READONLY", RULE_VALUE: "Readonly default" },
            { BASE_COL: "HIDDEN_COL", RULE_TYPE: "HIDDEN", RULE_VALUE: "Hidden default" },
            { BASE_COL: "ROUND_COL", RULE_TYPE: "ROUND", RULE_VALUE: "2" },
            { BASE_COL: "NUMFMT_COL", RULE_TYPE: "NUMBER_FORMAT", RULE_VALUE: '{"style":"currency","currency":"EUR"}' }
        ],
        dsmeta: [
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Name", VALUE: "DC996664.MPE_X_TEST" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observations", VALUE: "496" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Member Type", VALUE: "DATA" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Variables", VALUE: "9" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Engine", VALUE: "V9" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Indexes", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Created", VALUE: "09/26/2022 08:24:39" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Integrity Constraints", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Last Modified", VALUE: "09/26/2022 08:24:45" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observation Length", VALUE: "32947" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Protection", VALUE: " ." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Deleted Observations", VALUE: "0" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Type", VALUE: " ." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Compressed", VALUE: "CHAR" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Label", VALUE: " ." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Reuse Space", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Representation", VALUE: "WINDOWS_64" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Point to Observations", VALUE: "YES" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Encoding", VALUE: "wlatin1 Western (Windows)" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Sorted", VALUE: "NO" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Page Size", VALUE: "262144" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Pages", VALUE: "3" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index File Page Size", VALUE: "4096" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Index File Pages", VALUE: "4" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Repairs", VALUE: "0" },
            { ODS_TABLE: "ENGINEHOST", NAME: "ExtendObsCounter", VALUE: "YES" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Filename", VALUE: "C:DataControllerDC996664mpe_x_test.sas7bdat" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Release Created", VALUE: "9.0401M7" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Host Created", VALUE: "Linunx" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Owner Name", VALUE: "BUILTINAdministrators" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size", VALUE: " 1MB" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size (bytes)", VALUE: "1048576" }
        ],
        maxvarlengths: [
            { NAME: "_____DELETE__THIS__RECORD_____", MAXLEN: 3 },
            { NAME: "PRIMARY_KEY_FIELD", MAXLEN: 4 },
            { NAME: "some_char", MAXLEN: 591 },
            { NAME: "some_dropdown", MAXLEN: 8 },
            { NAME: "some_hardselect", MAXLEN: 7 },
            { NAME: "some_num", MAXLEN: 8 },
            { NAME: "some_date", MAXLEN: 10 },
            { NAME: "some_datetime", MAXLEN: 19 },
            { NAME: "some_time", MAXLEN: 8 },
            { NAME: "some_shortnum", MAXLEN: 3 },
            { NAME: "some_bestnum", MAXLEN: 3 },
            { NAME: "readonly_col", MAXLEN: 16 },
            { NAME: "hidden_col", MAXLEN: 14 },
            { NAME: "round_col", MAXLEN: 8 },
            { NAME: "numfmt_col", MAXLEN: 8 }
        ],
        query: [],
        sasdata: makeRows(100),
        $sasdata: {
            vars: {
                _____DELETE__THIS__RECORD_____: { format: "$3.", label: "_____DELETE__THIS__RECORD_____", length: "3", type: "char" },
                PRIMARY_KEY_FIELD: { format: "best.", label: "PRIMARY_KEY_FIELD", length: "8", type: "num" },
                SOME_CHAR: { format: "$32767.", label: "SOME_CHAR", length: "32767", type: "char" },
                SOME_DROPDOWN: { format: "$128.", label: "SOME_DROPDOWN", length: "128", type: "char" },
                SOME_HARDSELECT: { format: "$128.", label: "SOME_HARDSELECT", length: "128", type: "char" },
                SOME_NUM: { format: "best.", label: "SOME_NUM", length: "8", type: "num" },
                SOME_DATE: { format: "$200.", label: "SOME_DATE", length: "200", type: "char" },
                SOME_DATETIME: { format: "$200.", label: "SOME_DATETIME", length: "200", type: "char" },
                SOME_TIME: { format: "$200.", label: "SOME_TIME", length: "200", type: "char" },
                SOME_SHORTNUM: { format: "best.", label: "SOME_SHORTNUM", length: "4", type: "num" },
                SOME_BESTNUM: { format: "BEST.", label: "SOME_BESTNUM", length: "8", type: "num" },
                READONLY_COL: { format: "$200.", label: "READONLY_COL", length: "200", type: "char" },
                HIDDEN_COL: { format: "$200.", label: "HIDDEN_COL", length: "200", type: "char" },
                ROUND_COL: { format: "best.", label: "ROUND_COL", length: "8", type: "num" },
                NUMFMT_COL: { format: "best.", label: "NUMFMT_COL", length: "8", type: "num" }
            }
        },
        sasparams: [
            {
                COLHEADERS: "_____DELETE__THIS__RECORD_____,PRIMARY_KEY_FIELD,SOME_CHAR,SOME_DROPDOWN,SOME_HARDSELECT,SOME_NUM,SOME_DATE,SOME_DATETIME,SOME_TIME,SOME_SHORTNUM,SOME_BESTNUM,READONLY_COL,HIDDEN_COL,ROUND_COL,NUMFMT_COL",
                FILTER_TEXT: FILTER_TEXT,
                PKCNT: 1,
                PK: "PRIMARY_KEY_FIELD",
                DTVARS: " SOME_DATE",
                DTTMVARS: " SOME_DATETIME",
                TMVARS: " SOME_TIME",
                COLTYPE: "{\"data\":\"_____DELETE__THIS__RECORD_____\",\"type\":\"dropdown\",\"source\":[\"No\",\"Yes\"]},{\"data\":\"PRIMARY_KEY_FIELD\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"SOME_CHAR\"},{\"data\":\"SOME_DROPDOWN\"},{\"data\":\"SOME_HARDSELECT\"},{\"data\":\"SOME_NUM\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"SOME_DATE\",\"type\":\"date\"},{\"data\":\"SOME_DATETIME\",\"type\":\"datetime\"},{\"data\":\"SOME_TIME\",\"type\":\"time\"},{\"data\":\"SOME_SHORTNUM\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"SOME_BESTNUM\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"READONLY_COL\"},{\"data\":\"HIDDEN_COL\"},{\"data\":\"ROUND_COL\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"NUMFMT_COL\",\"type\":\"numeric\",\"format\":\"0\"}",
                LOADTYPE: "UPDATE",
                RK_FLAG: 0,
                CLS_FLAG: 0
            }
        ],
        xl_rules: [],
        _DEBUG: "",
        _METAUSER: "sasdemo@SAS",
        _METAPERSON: "sasdemo",
        _PROGRAM: "/Projects/app/dc/services/editors/getdata",
        AUTOEXEC: "D%3A%5Copt%5Csasinside%5CConfig%5CLev1%5CSASApp%5CStoredProcessServer%5Cautoexec.sas",
        MF_GETUSER: "sasdemo",
        SYSCC: "0",
        SYSENCODING: "wlatin1",
        SYSERRORTEXT: "",
        SYSHOSTNAME: "SAS",
        SYSPROCESSID: "41DD8056A491DB23409E940000000000",
        SYSPROCESSMODE: "SAS Stored Process Server",
        SYSPROCESSNAME: "",
        SYSJOBID: "27448",
        SYSSCPL: "Linunx",
        SYSSITE: "123",
        SYSUSERID: "sassrv",
        SYSVLONG: "9.04.01M7P080520",
        SYSWARNINGTEXT: "ENCODING option ignored for files opened with RECFM=N.",
        END_DTTM: "2022-09-26T08:30:13.853000",
        MEMSIZE: "46GB"
    },
    MPE_DATADICTIONARY: {
        SYSDATE: "25NOV22",
        SYSTIME: "12:48",
        approvers: [],
        cols: [
            {
                NAME: "DD_LONGDESC",
                VARNUM: 6,
                LABEL: "DD_LONGDESC",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_OWNER",
                VARNUM: 7,
                LABEL: "DD_OWNER",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_RESPONSIBLE",
                VARNUM: 8,
                LABEL: "DD_RESPONSIBLE",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_SENSITIVITY",
                VARNUM: 9,
                LABEL: "DD_SENSITIVITY",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_SHORTDESC",
                VARNUM: 5,
                LABEL: "DD_SHORTDESC",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_SOURCE",
                VARNUM: 4,
                LABEL: "DD_SOURCE",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DD_TYPE",
                VARNUM: 3,
                LABEL: "DD_TYPE",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "TX_FROM",
                VARNUM: 1,
                LABEL: "TX_FROM",
                FMTNAME: "datetime",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "TX_TO",
                VARNUM: 2,
                LABEL: "TX_TO",
                FMTNAME: "datetime",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            }
        ],
        dqdata: [
            { BASE_COL: "DD_TYPE", RULE_VALUE: "DD_TYPE", RULE_DATA: "COLUMN", SELECTBOX_ORDER: 1 },
            { BASE_COL: "DD_TYPE", RULE_VALUE: "DD_TYPE", RULE_DATA: "TABLE", SELECTBOX_ORDER: 2 },
            { BASE_COL: "DD_TYPE", RULE_VALUE: "DD_TYPE", RULE_DATA: "CATALOG", SELECTBOX_ORDER: 3 },
            { BASE_COL: "DD_TYPE", RULE_VALUE: "DD_TYPE", RULE_DATA: "FORMAT", SELECTBOX_ORDER: 3 },
            { BASE_COL: "DD_TYPE", RULE_VALUE: "DD_TYPE", RULE_DATA: "LIBRARY", SELECTBOX_ORDER: 3 }
        ],
        dqrules: [],
        dsmeta: [
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Name", VALUE: "MPE_DATADICTIONARY" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Member Type", VALUE: "DATA" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Engine", VALUE: "WPD" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Created", VALUE: "25NOV2022:12:48:00" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Last Modified", VALUE: "25NOV2022:12:48:01" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observations", VALUE: "6" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Variables", VALUE: "9" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Indexes", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observation Length", VALUE: "34399" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Deleted Observations", VALUE: "0" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Type", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Label", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Compressed", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Sorted", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Representation", VALUE: "Little endian, IEEE Unix" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Encoding", VALUE: "utf-8 UTF-8 Unicode" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Page Size", VALUE: "36864" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Pages", VALUE: "7" },
            { ODS_TABLE: "ENGINEHOST", NAME: "First Data Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Max Obs Per Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Obs In First Data Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Diagnostic Code", VALUE: "0009" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index File Page Size", VALUE: "4096" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Index File Pages", VALUE: "11" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index Diagnostic Code", VALUE: "0003" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Name", VALUE: "/tmp/mihajlo/DC083327/MPE_DATADICTIONARY.wpd" },
            { ODS_TABLE: "ENGINEHOST", NAME: "WPD Engine Version", VALUE: "3" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Large Data Set Support", VALUE: "no" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Inode Number", VALUE: "1040506" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Access Permission", VALUE: "rw-rw-r--" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Owner Name", VALUE: "mihajlo" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size (bytes)", VALUE: "225280" }
        ],
        maxvarlengths: [
            { NAME: "_____DELETE__THIS__RECORD_____", MAXLEN: 3 },
            { NAME: "DD_TYPE", MAXLEN: 9 },
            { NAME: "DD_SOURCE", MAXLEN: 30 },
            { NAME: "DD_SHORTDESC", MAXLEN: 53 },
            { NAME: "DD_LONGDESC", MAXLEN: 90 },
            { NAME: "DD_OWNER", MAXLEN: 7 },
            { NAME: "DD_RESPONSIBLE", MAXLEN: 7 },
            { NAME: "DD_SENSITIVITY", MAXLEN: 3 }
        ],
        query: [],
        sasdata: [
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "COLUMN",
                DD_SOURCE: "DC083327.MPE_CONFIG.VAR_ACTIVE",
                DD_SHORTDESC: "Set to 1 to make an option active",
                DD_LONGDESC: "This value is used as a filter by data controller whenever querying for option settings.",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "COLUMN",
                DD_SOURCE: "DC083327.MPE_TABLES.DSN",
                DD_SHORTDESC: "Dataset Name to be edited",
                DD_LONGDESC: "_DSN_ - must be UPCASE",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "DIRECTORY",
                DD_SOURCE: "/some/directory",
                DD_SHORTDESC: "Directory for some purpose",
                DD_LONGDESC: "This directory is great.  It's great directory.      It trumps all other directories.",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "LIBRARY",
                DD_SOURCE: "DC083327",
                DD_SHORTDESC: "Data Controller Control Tables",
                DD_LONGDESC: "# The Data Controller Library",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "TABLE",
                DD_SOURCE: "DC083327",
                DD_SHORTDESC: "Transaction table for capturing Data Controller users",
                DD_LONGDESC: "After a user accepts the Data Controller EULA they are registered as a user in this table.",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                DD_TYPE: "TABLE",
                DD_SOURCE: "DC083327.MPE_TABLES",
                DD_SHORTDESC: "Configuration of new tables for Data Controller",
                DD_LONGDESC: "# MPE_TABLES - adding new tabels to Data Controller",
                DD_OWNER: "mihajlo",
                DD_RESPONSIBLE: "mihajlo",
                DD_SENSITIVITY: "Low"
            }
        ],
        $sasdata: {
            vars: {
                _____DELETE__THIS__RECORD_____: { format: "$3.", label: "_____DELETE__THIS__RECORD_____", length: "3", type: "char" },
                DD_TYPE: { format: "$16.", label: "DD_TYPE", length: "16", type: "char" },
                DD_SOURCE: { format: "$1024.", label: "DD_SOURCE", length: "1024", type: "char" },
                DD_SHORTDESC: { format: "$256.", label: "DD_SHORTDESC", length: "256", type: "char" },
                DD_LONGDESC: { format: "$32767.", label: "DD_LONGDESC", length: "32767", type: "char" },
                DD_OWNER: { format: "$128.", label: "DD_OWNER", length: "128", type: "char" },
                DD_RESPONSIBLE: { format: "$128.", label: "DD_RESPONSIBLE", length: "128", type: "char" },
                DD_SENSITIVITY: { format: "$64.", label: "DD_SENSITIVITY", length: "64", type: "char" }
            }
        },
        sasparams: [
            {
                COLHEADERS: "_____DELETE__THIS__RECORD_____,DD_TYPE,DD_SOURCE,DD_SHORTDESC,DD_LONGDESC,DD_OWNER,DD_RESPONSIBLE,DD_SENSITIVITY",
                FILTER_TEXT: "(\"%sysfunc(datetime(), DATETIME19.3 )\"dt < TX_TO )",
                PKCNT: 2,
                PK: "DD_TYPE DD_SOURCE",
                DTVARS: "",
                DTTMVARS: "",
                TMVARS: "",
                COLTYPE: "{\"data\":\"_____DELETE__THIS__RECORD_____\",\"type\":\"dropdown\",\"source\":[\"No\",\"Yes\"]},{\"data\":\"DD_TYPE\"},{\"data\":\"DD_SOURCE\"},{\"data\":\"DD_SHORTDESC\"},{\"data\":\"DD_LONGDESC\"},{\"data\":\"DD_OWNER\"},{\"data\":\"DD_RESPONSIBLE\"},{\"data\":\"DD_SENSITIVITY\"}",
                LOADTYPE: "TXTEMPORAL",
                RK_FLAG: 0,
                CLS_FLAG: 0
            }
        ],
        xl_rules: [
            { XL_COLUMN: "DD_LONGDESC", XL_RULE: "FORMULA" }
        ],
        _DEBUG: "",
        _PROGRAM: "/30.SASApps/app/dc/services/editors/getdata",
        AUTOEXEC: "%2Fhome%2Fmihajlo%2Fsasjs_root%2Fsessions%2F20221125124822-23413-1669380502499%2Fautoexec.sas",
        MF_GETUSER: "mihajlo",
        SYSCC: "0",
        SYSENCODING: "utf-8",
        SYSERRORTEXT: "",
        SYSHOSTINFOLONG: "",
        SYSHOSTNAME: "",
        SYSPROCESSID: "1",
        SYSPROCESSMODE: "Stored Program",
        SYSPROCESSNAME: "",
        SYSJOBID: "1084774",
        SYSSCPL: "LINUX",
        SYSSITE: "123",
        SYSTCPIPHOSTNAME: "",
        SYSUSERID: "mihajlo",
        SYSVLONG: "05.00.00.03.002208",
        SYSWARNINGTEXT: "",
        END_DTTM: "2022-11-25T12:49:06.877398",
        MEMSIZE: "0KB"
    },
    MPE_USERS: {
        SYSDATE: "01DEC22",
        SYSTIME: "12:40",
        approvers: [],
        cols: [
            {
                NAME: "LAST_SEEN_DT",
                VARNUM: 2,
                LABEL: "LAST_SEEN_DT",
                FMTNAME: "date",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "REGISTERED_DT",
                VARNUM: 3,
                LABEL: "REGISTERED_DT",
                FMTNAME: "date",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "USER_ID",
                VARNUM: 1,
                LABEL: "USER_ID",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            }
        ],
        dqdata: [],
        dqrules: [],
        dsmeta: [
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Name", VALUE: "MPE_USERS" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Member Type", VALUE: "DATA" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Engine", VALUE: "WPD" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Created", VALUE: "25NOV2022:12:48:00" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Last Modified", VALUE: "01DEC2022:12:41:16" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observations", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Variables", VALUE: "3" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Indexes", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observation Length", VALUE: "66" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Deleted Observations", VALUE: "0" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Type", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Label", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Compressed", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Sorted", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Representation", VALUE: "Little endian, IEEE Unix" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Encoding", VALUE: "utf-8 UTF-8 Unicode" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Page Size", VALUE: "4096" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Pages", VALUE: "2" },
            { ODS_TABLE: "ENGINEHOST", NAME: "First Data Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Max Obs Per Page", VALUE: "61" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Obs In First Data Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Diagnostic Code", VALUE: "0009" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index File Page Size", VALUE: "4096" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Index File Pages", VALUE: "3" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index Diagnostic Code", VALUE: "0003" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Name", VALUE: "/tmp/mihajlo/DC083327/MPE_USERS.wpd" },
            { ODS_TABLE: "ENGINEHOST", NAME: "WPD Engine Version", VALUE: "3" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Large Data Set Support", VALUE: "no" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Inode Number", VALUE: "1040545" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Access Permission", VALUE: "rw-rw-r--" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Owner Name", VALUE: "mihajlo" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size (bytes)", VALUE: "8192" }
        ],
        maxvarlengths: [
            { NAME: "_____DELETE__THIS__RECORD_____", MAXLEN: 3 },
            { NAME: "USER_ID", MAXLEN: 0 }
        ],
        query: [],
        sasdata: [
            { _____DELETE__THIS__RECORD_____: "No", USER_ID: "" }
        ],
        $sasdata: {
            vars: {
                _____DELETE__THIS__RECORD_____: { format: "$3.", label: "_____DELETE__THIS__RECORD_____", length: "3", type: "char" },
                USER_ID: { format: "$50.", label: "USER_ID", length: "50", type: "char" }
            }
        },
        sasparams: [
            {
                COLHEADERS: "_____DELETE__THIS__RECORD_____,USER_ID",
                FILTER_TEXT: "(\"%sysfunc(datetime(), DATETIME19.3 )\"dt < REGISTERED_DT )",
                PKCNT: 1,
                PK: "USER_ID",
                DTVARS: "",
                DTTMVARS: "",
                TMVARS: "",
                COLTYPE: "{\"data\":\"_____DELETE__THIS__RECORD_____\",\"type\":\"dropdown\",\"source\":[\"No\",\"Yes\"]},{\"data\":\"USER_ID\"}",
                LOADTYPE: "UPDATE",
                RK_FLAG: 0,
                CLS_FLAG: 0
            }
        ],
        xl_rules: [],
        _DEBUG: "",
        _PROGRAM: "/30.SASApps/app/dc/services/editors/getdata",
        AUTOEXEC: "%2Fhome%2Fmihajlo%2Fsasjs_root%2Fsessions%2F20221201124053-21286-1669898453493%2Fautoexec.sas",
        MF_GETUSER: "mihajlo",
        SYSCC: "0",
        SYSENCODING: "utf-8",
        SYSERRORTEXT: "",
        SYSHOSTINFOLONG: "",
        SYSHOSTNAME: "sas.4gl.io",
        SYSPROCESSID: "41DD9626156A45BB0000000000000000",
        SYSPROCESSMODE: "Stored Program",
        SYSPROCESSNAME: "",
        SYSJOBID: "1146134",
        SYSSCPL: "LINUX",
        SYSSITE: "123",
        SYSTCPIPHOSTNAME: "https://sas.4gl.io:5002",
        SYSUSERID: "mihajlo",
        SYSVLONG: "05.00.00.03.002208",
        SYSWARNINGTEXT: "",
        END_DTTM: "2022-12-01T12:41:23.940217",
        MEMSIZE: "0KB"
    },
    MPE_TABLES: {
        SYSDATE: "10MAR23",
        SYSTIME: "12:38",
        approvers: [],
        cols: [
            {
                NAME: "AUDIT_LIBDS",
                VARNUM: 22,
                LABEL: "AUDIT_LIBDS",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "BUSKEY",
                VARNUM: 7,
                LABEL: "BUSKEY",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "CLOSE_VARS",
                VARNUM: 13,
                LABEL: "CLOSE_VARS",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "DSN",
                VARNUM: 4,
                LABEL: "DSN",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "LIBREF",
                VARNUM: 3,
                LABEL: "LIBREF",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "LOADTYPE",
                VARNUM: 6,
                LABEL: "LOADTYPE",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "NOTES",
                VARNUM: 20,
                LABEL: "NOTES",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "NUM_OF_APPROVALS_REQUIRED",
                VARNUM: 5,
                LABEL: "NUM_OF_APPROVALS_REQUIRED",
                FMTNAME: "",
                DDTYPE: "NUMERIC",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "POST_APPROVE_HOOK",
                VARNUM: 17,
                LABEL: "POST_APPROVE_HOOK",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "POST_EDIT_HOOK",
                VARNUM: 15,
                LABEL: "POST_EDIT_HOOK",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "PRE_APPROVE_HOOK",
                VARNUM: 16,
                LABEL: "PRE_APPROVE_HOOK",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "PRE_EDIT_HOOK",
                VARNUM: 14,
                LABEL: "PRE_EDIT_HOOK",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "RK_UNDERLYING",
                VARNUM: 21,
                LABEL: "RK_UNDERLYING",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SIGNOFF_COLS",
                VARNUM: 18,
                LABEL: "SIGNOFF_COLS",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "SIGNOFF_HOOK",
                VARNUM: 19,
                LABEL: "SIGNOFF_HOOK",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "TX_FROM",
                VARNUM: 1,
                LABEL: "TX_FROM",
                FMTNAME: "DATETIME",
                DDTYPE: "DATETIME",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "TX_TO",
                VARNUM: 2,
                LABEL: "TX_TO",
                FMTNAME: "DATETIME",
                DDTYPE: "DATETIME",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "VAR_BUSFROM",
                VARNUM: 10,
                LABEL: "VAR_BUSFROM",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "VAR_BUSTO",
                VARNUM: 11,
                LABEL: "VAR_BUSTO",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "VAR_PROCESSED",
                VARNUM: 12,
                LABEL: "VAR_PROCESSED",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "VAR_TXFROM",
                VARNUM: 8,
                LABEL: "VAR_TXFROM",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            },
            {
                NAME: "VAR_TXTO",
                VARNUM: 9,
                LABEL: "VAR_TXTO",
                FMTNAME: "",
                DDTYPE: "CHARACTER",
                CLS_RULE: "READ",
                MEMLABEL: "",
                DESC: "",
                LONGDESC: ""
            }
        ],
        dqdata: [
            { BASE_COL: "LOADTYPE", RULE_VALUE: "LOADTYPE", RULE_DATA: "UPDATE", SELECTBOX_ORDER: 1 },
            { BASE_COL: "LOADTYPE", RULE_VALUE: "LOADTYPE", RULE_DATA: "REPLACE", SELECTBOX_ORDER: 2 },
            { BASE_COL: "LOADTYPE", RULE_VALUE: "LOADTYPE", RULE_DATA: "TXTEMPORAL", SELECTBOX_ORDER: 3 },
            { BASE_COL: "LOADTYPE", RULE_VALUE: "LOADTYPE", RULE_DATA: "BITEMPORAL", SELECTBOX_ORDER: 4 },
            { BASE_COL: "LOADTYPE", RULE_VALUE: "LOADTYPE", RULE_DATA: "FORMAT_CAT", SELECTBOX_ORDER: 5 }
        ],
        dqrules: [
            { BASE_COL: "BUSKEY", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "BUSKEY", RULE_TYPE: "NOTNULL", RULE_VALUE: "", X: 0 },
            { BASE_COL: "DSN", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "DSN", RULE_TYPE: "NOTNULL", RULE_VALUE: "", X: 0 },
            { BASE_COL: "DSN", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/mpe_tables.dsn", X: 0 },
            { BASE_COL: "LIBREF", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "LIBREF", RULE_TYPE: "NOTNULL", RULE_VALUE: "", X: 0 },
            { BASE_COL: "LIBREF", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/libraries_all", X: 0 },
            { BASE_COL: "NUM_OF_APPROVALS_REQUIRED", RULE_TYPE: "MINVAL", RULE_VALUE: "1", X: 0 },
            { BASE_COL: "VAR_BUSFROM", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "VAR_BUSFROM", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/columns_in_libds", X: 0 },
            { BASE_COL: "VAR_BUSTO", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "VAR_BUSTO", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/columns_in_libds", X: 0 },
            { BASE_COL: "VAR_PROCESSED", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "VAR_PROCESSED", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/columns_in_libds", X: 0 },
            { BASE_COL: "VAR_TXFROM", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "VAR_TXFROM", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/columns_in_libds", X: 0 },
            { BASE_COL: "VAR_TXTO", RULE_TYPE: "CASE", RULE_VALUE: "UPCASE", X: 0 },
            { BASE_COL: "VAR_TXTO", RULE_TYPE: "SOFTSELECT_HOOK", RULE_VALUE: "services/validations/columns_in_libds", X: 0 }
        ],
        dsmeta: [
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Name", VALUE: "DC200241.MPE_TABLES" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observations", VALUE: "14" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Member Type", VALUE: "DATA" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Variables", VALUE: "22" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Engine", VALUE: "V9" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Indexes", VALUE: "1" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Created", VALUE: "14/02/2023 17:21:19" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Integrity Constraints", VALUE: "4" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Last Modified", VALUE: "14/02/2023 17:21:19" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Observation Length", VALUE: "5280" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Protection", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Deleted Observations", VALUE: "0" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Set Type", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Compressed", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Label", VALUE: "." },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Sorted", VALUE: "NO" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Data Representation", VALUE: "SOLARIS_X86_64, LINUX_X86_64, ALPHA_TRU64, LINUX_IA64" },
            { ODS_TABLE: "ATTRIBUTES", NAME: "Encoding", VALUE: "utf-8  Unicode (UTF-8)" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Data Set Page Size", VALUE: "131072" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Pages", VALUE: "2" },
            { ODS_TABLE: "ENGINEHOST", NAME: "First Data Page", VALUE: "1" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Max Obs per Page", VALUE: "24" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Obs in First Data Page", VALUE: "14" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Index File Page Size", VALUE: "8192" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Index File Pages", VALUE: "2" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Number of Data Set Repairs", VALUE: "0" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Filename", VALUE: "/tmp/DataController/DC200241/mpe_tables.sas7bdat" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Release Created", VALUE: "9.0401M7" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Host Created", VALUE: "Linux" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Inode Number", VALUE: "20976367" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Access Permission", VALUE: "rw-rw-r--" },
            { ODS_TABLE: "ENGINEHOST", NAME: "Owner Name", VALUE: "sasjssrv" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size", VALUE: "384KB" },
            { ODS_TABLE: "ENGINEHOST", NAME: "File Size (bytes)", VALUE: "393216" }
        ],
        maxvarlengths: [
            { NAME: "_____DELETE__THIS__RECORD_____", MAXLEN: 3 },
            { NAME: "LIBREF", MAXLEN: 8 },
            { NAME: "DSN", MAXLEN: 25 },
            { NAME: "num_of_approvals_required", MAXLEN: 3 },
            { NAME: "loadtype", MAXLEN: 10 },
            { NAME: "buskey", MAXLEN: 56 },
            { NAME: "var_txfrom", MAXLEN: 13 },
            { NAME: "var_txto", MAXLEN: 11 },
            { NAME: "var_busfrom", MAXLEN: 0 },
            { NAME: "var_busto", MAXLEN: 0 },
            { NAME: "var_processed", MAXLEN: 0 },
            { NAME: "close_vars", MAXLEN: 0 },
            { NAME: "pre_edit_hook", MAXLEN: 0 },
            { NAME: "post_edit_hook", MAXLEN: 49 },
            { NAME: "pre_approve_hook", MAXLEN: 0 },
            { NAME: "post_approve_hook", MAXLEN: 0 },
            { NAME: "signoff_cols", MAXLEN: 0 },
            { NAME: "signoff_hook", MAXLEN: 0 },
            { NAME: "notes", MAXLEN: 62 },
            { NAME: "rk_underlying", MAXLEN: 137 },
            { NAME: "audit_libds", MAXLEN: 0 }
        ],
        query: [],
        sasdata: [
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_ALERTS",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "ALERT_EVENT ALERT_LIB ALERT_DS ALERT_USER",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration for alert email events",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_COLUMN_LEVEL_SECURITY",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "CLS_SCOPE CLS_GROUP CLS_LIBREF CLS_TABLE CLS_VARIABLE_NM",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "services/hooks/mpe_column_level_security_postedit",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Docs: https://docs.datacontroller.io/column-level-security",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_CONFIG",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "VAR_SCOPE VAR_NAME",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration variables for Data Controller",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_DATADICTIONARY",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "DD_TYPE DD_SOURCE",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration of data dictionary",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_EMAILS",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "USER_NAME",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Primary Emails Table (backup is metadata)",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_EXCEL_CONFIG",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "XL_LIBREF XL_TABLE XL_COLUMN",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration of the excel import rules",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_GROUPS",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "GROUP_NAME USER_NAME",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration for additional groups within Data Controller",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_LOCKANYTABLE",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "UPDATE",
                BUSKEY: "LOCK_LIB LOCK_DS",
                VAR_TXFROM: "",
                VAR_TXTO: "",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "This table may be edited when a process failed and left a lock",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_ROW_LEVEL_SECURITY",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "RLS_RK",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "services/hooks/mpe_row_level_security_postedit",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration of Row Level Security",
                RK_UNDERLYING: "RLS_SCOPE RLS_GROUP RLS_LIBREF RLS_TABLE RLS_GROUP_LOGIC RLS_SUBGROUP_LOGIC RLS_SUBGROUP_ID RLS_VARIABLE_NM RLS_OPERATOR_NM RLS_RAW_VALUE",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_SECURITY",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "LIBREF DSN ACCESS_LEVEL SAS_GROUP",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Shows which metadata groups can edit which tables",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_SELECTBOX",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "SELECTBOX_RK",
                VAR_TXFROM: "VER_FROM_DTTM",
                VAR_TXTO: "VER_TO_DTTM",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Can configure dropdowns for the front end",
                RK_UNDERLYING: "SELECT_LIB SELECT_DS BASE_COLUMN SELECTBOX_VALUE",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_TABLES",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "LIBREF DSN",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "services/hooks/mpe_tables_postedit",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "This entry allows the MP Editor to edit itself!",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_VALIDATIONS",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "TXTEMPORAL",
                BUSKEY: "BASE_LIB BASE_DS BASE_COL RULE_TYPE",
                VAR_TXFROM: "TX_FROM",
                VAR_TXTO: "TX_TO",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "services/hooks/mpe_validations_postedit",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Configuration of data quality rules in Editor component",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            },
            {
                _____DELETE__THIS__RECORD_____: "No",
                LIBREF: "DC200241",
                DSN: "MPE_X_TEST",
                NUM_OF_APPROVALS_REQUIRED: 1,
                LOADTYPE: "UPDATE",
                BUSKEY: "PRIMARY_KEY_FIELD",
                VAR_TXFROM: "",
                VAR_TXTO: "",
                VAR_BUSFROM: "",
                VAR_BUSTO: "",
                VAR_PROCESSED: "",
                CLOSE_VARS: "",
                PRE_EDIT_HOOK: "",
                POST_EDIT_HOOK: "",
                PRE_APPROVE_HOOK: "",
                POST_APPROVE_HOOK: "",
                SIGNOFF_COLS: "",
                SIGNOFF_HOOK: "",
                NOTES: "Test table for controller",
                RK_UNDERLYING: "",
                AUDIT_LIBDS: ""
            }
        ],
        $sasdata: {
            vars: {
                _____DELETE__THIS__RECORD_____: { format: "$3.", label: "_____DELETE__THIS__RECORD_____", length: "3", type: "char" },
                LIBREF: { format: "$8.", label: "LIBREF", length: "8", type: "char" },
                DSN: { format: "$32.", label: "DSN", length: "32", type: "char" },
                NUM_OF_APPROVALS_REQUIRED: { format: "best.", label: "NUM_OF_APPROVALS_REQUIRED", length: "8", type: "num" },
                LOADTYPE: { format: "$12.", label: "LOADTYPE", length: "12", type: "char" },
                BUSKEY: { format: "$1000.", label: "BUSKEY", length: "1000", type: "char" },
                VAR_TXFROM: { format: "$32.", label: "VAR_TXFROM", length: "32", type: "char" },
                VAR_TXTO: { format: "$32.", label: "VAR_TXTO", length: "32", type: "char" },
                VAR_BUSFROM: { format: "$32.", label: "VAR_BUSFROM", length: "32", type: "char" },
                VAR_BUSTO: { format: "$32.", label: "VAR_BUSTO", length: "32", type: "char" },
                VAR_PROCESSED: { format: "$32.", label: "VAR_PROCESSED", length: "32", type: "char" },
                CLOSE_VARS: { format: "$500.", label: "CLOSE_VARS", length: "500", type: "char" },
                PRE_EDIT_HOOK: { format: "$200.", label: "PRE_EDIT_HOOK", length: "200", type: "char" },
                POST_EDIT_HOOK: { format: "$200.", label: "POST_EDIT_HOOK", length: "200", type: "char" },
                PRE_APPROVE_HOOK: { format: "$200.", label: "PRE_APPROVE_HOOK", length: "200", type: "char" },
                POST_APPROVE_HOOK: { format: "$200.", label: "POST_APPROVE_HOOK", length: "200", type: "char" },
                SIGNOFF_COLS: { format: "$500.", label: "SIGNOFF_COLS", length: "500", type: "char" },
                SIGNOFF_HOOK: { format: "$200.", label: "SIGNOFF_HOOK", length: "200", type: "char" },
                NOTES: { format: "$1000.", label: "NOTES", length: "1000", type: "char" },
                RK_UNDERLYING: { format: "$1000.", label: "RK_UNDERLYING", length: "1000", type: "char" },
                AUDIT_LIBDS: { format: "$41.", label: "AUDIT_LIBDS", length: "41", type: "char" }
            }
        },
        sasparams: [
            {
                COLHEADERS: "_____DELETE__THIS__RECORD_____,LIBREF,DSN,NUM_OF_APPROVALS_REQUIRED,LOADTYPE,BUSKEY,VAR_TXFROM,VAR_TXTO,VAR_BUSFROM,VAR_BUSTO,VAR_PROCESSED,CLOSE_VARS,PRE_EDIT_HOOK,POST_EDIT_HOOK,PRE_APPROVE_HOOK,POST_APPROVE_HOOK,SIGNOFF_COLS,SIGNOFF_HOOK,NOTES,RK_UNDERLYING,AUDIT_LIBDS",
                FILTER_TEXT: "(\"%sysfunc(datetime(), E8601DT26.6 )\"dt < TX_TO )",
                PKCNT: 2,
                PK: "LIBREF DSN",
                DTVARS: "",
                DTTMVARS: "",
                TMVARS: "",
                COLTYPE: "{\"data\":\"_____DELETE__THIS__RECORD_____\",\"type\":\"dropdown\",\"source\":[\"No\",\"Yes\"]},{\"data\":\"LIBREF\"},{\"data\":\"DSN\"},{\"data\":\"NUM_OF_APPROVALS_REQUIRED\",\"type\":\"numeric\",\"format\":\"0\"},{\"data\":\"LOADTYPE\"},{\"data\":\"BUSKEY\"},{\"data\":\"VAR_TXFROM\"},{\"data\":\"VAR_TXTO\"},{\"data\":\"VAR_BUSFROM\"},{\"data\":\"VAR_BUSTO\"},{\"data\":\"VAR_PROCESSED\"},{\"data\":\"CLOSE_VARS\"},{\"data\":\"PRE_EDIT_HOOK\"},{\"data\":\"POST_EDIT_HOOK\"},{\"data\":\"PRE_APPROVE_HOOK\"},{\"data\":\"POST_APPROVE_HOOK\"},{\"data\":\"SIGNOFF_COLS\"},{\"data\":\"SIGNOFF_HOOK\"},{\"data\":\"NOTES\"},{\"data\":\"RK_UNDERLYING\"},{\"data\":\"AUDIT_LIBDS\"}",
                LOADTYPE: "TXTEMPORAL",
                RK_FLAG: 0,
                CLS_FLAG: 0
            }
        ],
        xl_rules: [],
        _DEBUG: "",
        _PROGRAM: "/Public/app/dc/services/editors/getdata",
        AUTOEXEC: "%2Fhome%2Fsasjssrv%2Fsasjs_root%2Fsessions%2F20230310113844-59661-1678448324767%2Fautoexec.sas",
        MF_GETUSER: "mihajlo",
        SYSCC: "0",
        SYSENCODING: "utf-8",
        SYSERRORTEXT: "",
        SYSHOSTINFOLONG: "Linux LIN X64 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 CentOS Linux release 7.9.2009 (Core)",
        SYSHOSTNAME: "CentOS-79-64-minimal",
        SYSPROCESSID: "41DDB6C7153602864018000000000000",
        SYSPROCESSMODE: "SAS Batch Mode",
        SYSPROCESSNAME: "",
        SYSJOBID: "24007",
        SYSSCPL: "Linux",
        SYSSITE: "123",
        SYSTCPIPHOSTNAME: "CentOS-79-64-minimal",
        SYSUSERID: "sasjssrv",
        SYSVLONG: "9.04.01M7P080520",
        SYSWARNINGTEXT: "ENCODING option ignored for files opened with RECFM=N.",
        END_DTTM: "2023-03-10T12:39:16.070656",
        MEMSIZE: "2GB"
    }
}

// The DQ-rule demo columns (HARDSELECT / READONLY / HIDDEN / ROUND /
// NUMBER_FORMAT) live on their own mock table, MPE_X_NEW, so that the shared
// MPE_X_TEST keeps matching the excel upload fixtures (which predate these
// columns). The demo tables are built lazily (below) so we don't clone the large
// MPE_X_TEST payload unless MPE_X_NEW is actually requested.
const RULE_DEMO_COLS = ['SOME_HARDSELECT', 'READONLY_COL', 'HIDDEN_COL', 'ROUND_COL', 'NUMFMT_COL']

function stripRuleCols(t) {
    const uc = new Set(RULE_DEMO_COLS)
    const lc = new Set(RULE_DEMO_COLS.map((c) => c.toLowerCase()))

    t.cols = t.cols.filter((c) => !uc.has(c.NAME))
    t.dqdata = t.dqdata.filter((d) => !uc.has(d.BASE_COL))
    t.dqrules = t.dqrules.filter((r) => !uc.has(r.BASE_COL))
    t.maxvarlengths = t.maxvarlengths.filter((m) => !lc.has((m.NAME || '').toLowerCase()))
    RULE_DEMO_COLS.forEach((c) => delete t.$sasdata.vars[c])
    t.sasdata = t.sasdata.map((row) => {
        const r = { ...row }
        RULE_DEMO_COLS.forEach((c) => delete r[c])
        return r
    })
    t.sasparams = t.sasparams.map((p) => {
        const headers = p.COLHEADERS.split(',').filter((h) => !uc.has(h))
        const coltype = JSON.parse('[' + p.COLTYPE + ']')
            .filter((o) => !uc.has(o.data))
            .map((o) => JSON.stringify(o))
            .join(',')
        return { ...p, COLHEADERS: headers.join(','), COLTYPE: coltype }
    })
    return t
}

let table = 'MPE_X_TEST'

if (_WEBIN_FILEREF1) {
    const file1 = _WEBIN_FILEREF1.toString()

    if (file1.includes('MPE_X_NEW')) {
        table = 'MPE_X_NEW'
    } else if (file1.includes('MPE_X_TEST')) {
        table = 'MPE_X_TEST'
    } else if (file1.includes('MPE_DATADICTIONARY')) {
        table = "MPE_DATADICTIONARY"
    } else if (file1.includes('MPE_USERS')) {
        table = "MPE_USERS"
    } else if (file1.includes('MPE_TABLES')) {
        table = "MPE_TABLES"
    }
}

// Build the DQ-rule demo tables lazily — only for the table actually requested.
if (table === 'MPE_X_NEW') {
    // MPE_X_NEW: full clone of MPE_X_TEST that retains the rule columns.
    webouts.MPE_X_NEW = JSON.parse(JSON.stringify(webouts.MPE_X_TEST))
    webouts.MPE_X_NEW.dsmeta = webouts.MPE_X_NEW.dsmeta.map((m) =>
        m.NAME === 'Data Set Name' ? { ...m, VALUE: m.VALUE.replace('MPE_X_TEST', 'MPE_X_NEW') } : m
    )
} else if (table === 'MPE_X_TEST') {
    // MPE_X_TEST: strip the rule columns so it matches the excel upload fixtures.
    stripRuleCols(webouts.MPE_X_TEST)
}

_webout = JSON.stringify(webouts[table])