{"id":29221,"date":"2021-07-30T07:51:13","date_gmt":"2021-07-30T06:51:13","guid":{"rendered":"https:\/\/multisite.korebots.com\/v9-0\/?p=29221"},"modified":"2021-07-30T10:22:36","modified_gmt":"2021-07-30T09:22:36","slug":"data-table","status":"publish","type":"post","link":"https:\/\/multisite.korebots.com\/v9-0\/docs\/bots\/advanced-topics\/data-table\/","title":{"rendered":"Data Table"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row via_grid cols_1 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p>From the Data tab of the Bot Builder Landing Page, click\u00a0Create Data Tables to create a data table.<\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624124728\/data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28012\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624124728\/data.png\" alt=\"\" width=\"1363\" height=\"371\" \/><\/a><\/p>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1><span class=\"ez-toc-section\" id=\"Creation\"><\/span>Creation<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Create Data Table would open\u00a0<strong>New Table<\/strong> page where you have to enter the following details:<\/p>\n<ul>\n<li><strong>Name<\/strong> of the Data Table;<\/li>\n<li><strong>Description<\/strong> of the Data Table;<\/li>\n<li><strong>Columns<\/strong> to be included in the Table;<\/li>\n<li><strong>Indexes<\/strong> for the Table;<\/li>\n<li><strong>Bot Assignment<\/strong> for accessing the data in this table;<\/li>\n<li><strong>App Assignment<\/strong> for accessing\u00a0the data in this table.<\/li>\n<\/ul>\n<\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125021\/data_table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28014\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125021\/data_table.png\" alt=\"\" width=\"703\" height=\"707\" \/><\/a><\/p>\n<\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1><span class=\"ez-toc-section\" id=\"Columns\"><\/span>Columns<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>The second step in defining a Data Table would be to add columns that make up the table. Column definition includes:<\/p>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125146\/data_cols.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28016\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125146\/data_cols.png\" alt=\"\" width=\"1081\" height=\"427\" \/><\/a><\/p>\n<ul>\n<li><strong>Name<\/strong> of the column (<a href=\"#reserve-words\">see here<\/a> for reserve words which cannot be used as the name of a column);<\/li>\n<li><strong>Type<\/strong> of the data that can be stored in this column. It can be:\n<ul>\n<li>string;<\/li>\n<li>date; or<\/li>\n<li>number.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Required<\/strong> flag to mark the column as mandatory.<\/li>\n<li><strong>Encrypted<\/strong> flag to secure the data in this column.<\/li>\n<li><strong>Reference Column<\/strong> to create a dependency with a column from another table ie to add a foreign key constraint. This would ensure that the value entered for this column exists in the referenced table column.<\/li>\n<li><strong>Max Length<\/strong> to limit the maximum length for the column values.<\/li>\n<li><strong>Default Values<\/strong> to be taken in case the value is missing while adding a row.<\/li>\n<\/ul>\n<p>By default the following columns would be defined by the platform:<\/p>\n<ul>\n<li><strong>sys_Id<\/strong>: A platform generated unique identifier for each row in the table.<\/li>\n<li><strong>Created_On<\/strong>: Timestamp when this table was created;<\/li>\n<li><strong>Updated_On<\/strong>: Timestamp when this table was updated;<\/li>\n<li><strong>Created_By<\/strong>: User id of the developer who created this table;<\/li>\n<li><strong>Updated_By<\/strong>: User id of the developer who last updated this table.<\/li>\n<\/ul>\n<\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1><span class=\"ez-toc-section\" id=\"Index\"><\/span>Index<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>For an improved performance during Data search and retrieval, you can define Indices for your Data Table.<\/p>\n<p>This includes:<\/p>\n<ul>\n<li><strong>Index Name<\/strong> for reference;<\/li>\n<li><strong>Is Unique<\/strong> flag to define if the index is expected to contain unique values;<\/li>\n<li><strong>Column &amp; Sort Order<\/strong> &#8211; List of columns to be included in the index; you can select multiple columns and specify the sort order (ascending or descending) for each of the selected columns.<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125225\/data_index.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28018\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125225\/data_index.png\" alt=\"\" width=\"1075\" height=\"433\" \/><\/a><\/p>\n<\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1><span class=\"ez-toc-section\" id=\"Assignments\"><\/span>Assignments<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>You can define the assignments for each of the data tables as follows:<\/p>\n<ul>\n<li><strong>Assign bots:<\/strong>\n<ul>\n<li>Assign bots with Read, Write, and Delete permissions. You can select the bots from the list presented, these will be the list of bots owned by you and shared with you.<\/li>\n<li>Only the assigned bots will be allowed to access the data from the data table using the Service Nodes in the Dialog Tasks of that bot.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Assign apps:<\/strong>\n<ul>\n<li>Assign apps with Read, Write, and Delete permissions.<\/li>\n<li>You can select from the list or create a new app.<\/li>\n<li>The data table CRUD APIs will be restricted to access only the tables that are assigned to the app.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Assign process apps:<\/strong>\n<ul>\n<li>Assign process apps with Read, Write, and Delete permissions. You can select the process apps from the list presented, these will be the list of process apps owned by you and shared with you.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125342\/data_assign.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28020\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125342\/data_assign.png\" alt=\"\" width=\"1068\" height=\"420\" \/><\/a><\/p>\n<\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1><span class=\"ez-toc-section\" id=\"Import_Export\"><\/span>Import &amp; Export<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Data Table definition can be exported and imported as JSON format files.<\/p>\n<p><strong>To Export<\/strong>:<\/p>\n<ol>\n<li>Hover over the table definition that you want to Export<\/li>\n<li>Click the more (ellipses) icon and select\u00a0<strong>Export Definition<\/strong><\/li>\n<li>JSON file would be generated and downloaded.<br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125413\/data_options.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28022\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125413\/data_options.png\" alt=\"\" width=\"1119\" height=\"289\" \/><\/a><\/li>\n<\/ol>\n<p><strong>To Import<\/strong>:<\/p>\n<ol>\n<li>Click the\u00a0<strong>down arrow<\/strong> next to the New Table button.<\/li>\n<li>Select the\u00a0<strong>Import Table Definition<\/strong> option.<\/li>\n<li>Enter a\u00a0<strong>Table Name<\/strong> and select the JSON file containing the table definition.<\/li>\n<li>Click\u00a0<strong>Import.<\/strong><br \/>\n<a ref=\"magnificPopup\" href=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125525\/data_import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28024\" src=\"https:\/\/s3-us-east-2.amazonaws.com\/kore-wordpress\/developer.kore.ai\/wp-content\/uploads\/sites\/22\/20210624125525\/data_import.png\" alt=\"\" width=\"1129\" height=\"261\" \/><\/a><\/li>\n<\/ol>\n<p><strong>Sample Data Definition JSON file<\/strong><\/p>\n<pre>{\"name\":\"customertable\",\r\n \"description\":\"Table containing customer details\",\r\n \"indexes\":[],\r\n \"schemaDef\":[{\"name\":\"CustEmail\",\r\n               \"type\":\"string\",\r\n               \"isRequired\":false,\r\n               \"isEncrypted\":false,\r\n               \"reference\":{},\r\n               \"maxLength\":\"\",\r\n               \"default\":\"\"},\r\n\t      {\"name\":\"CustType\",\r\n               \"type\":\"string\",\r\n               \"isRequired\":false,\r\n               \"isEncrypted\":false,\r\n               \"reference\":{},\r\n               \"maxLength\":\"\",\r\n               \"default\":\"Preferred\"},\r\n\t      {\"name\":\"Address\",\r\n               \"type\":\"string\",\r\n               \"isRequired\":false,\r\n               \"isEncrypted\":false,\r\n               \"reference\":{},\r\n               \"maxLength\":\"\",\r\n               \"default\":\"\"},\r\n\t      {\"name\":\"CustName\",\r\n               \"type\":\"string\",\r\n               \"isRequired\":true,\r\n               \"isEncrypted\":false,\r\n               \"reference\":{},\r\n               \"maxLength\":\"\",\r\n               \"default\":\"\"},\r\n\t      {\"name\":\"CustId\",\r\n               \"type\":\"number\",\r\n               \"isRequired\":true,\r\n               \"isEncrypted\":true,\r\n               \"reference\":{},\r\n               \"maxLength\":\"5\",\r\n               \"default\":\"\"},\r\n\t      {\"name\":\"sys_Id\",\"type\":\"string\",\"isRequired\":true,\"readOnly\":true},\r\n\t      {\"name\":\"Created_On\",\"type\":\"date\",\"isRequired\":true,\"readOnly\":true},\r\n\t      {\"name\":\"Updated_On\",\"type\":\"date\",\"isRequired\":true,\"readOnly\":true},\r\n\t      {\"name\":\"Created_By\",\"type\":\"string\",\"isRequired\":true,\"readOnly\":true},\r\n\t      {\"name\":\"Updated_By\",\"type\":\"string\",\"isRequired\":true,\"readOnly\":true}]}<\/pre>\n<\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><h1 id=\"reserve-words\"><span class=\"ez-toc-section\" id=\"Reserve_Words\"><\/span>Reserve Words<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Following is the list of words that are reserved and cannot be used as the names for a column:<\/p>\n<\/div><\/div><div class=\"g-cols wpb_row via_grid cols_3 laptops-cols_inherit tablets-cols_inherit mobiles-cols_1 valign_top type_default stacking_default\" style=\"--gap:3rem;\"><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><ul>\n<li>ACCESS<\/li>\n<li>ADD<\/li>\n<li>ALL<\/li>\n<li>ALTER<\/li>\n<li>AND<\/li>\n<li>ANY<\/li>\n<li>AS<\/li>\n<li>ASC<\/li>\n<li>AUDIT<\/li>\n<li>BETWEEN<\/li>\n<li>BY<\/li>\n<li>CHAR\\<\/li>\n<li>CHECK<\/li>\n<li>CLUSTER<\/li>\n<li>COLUMN<\/li>\n<li>COMMENT<\/li>\n<li>COMPRESS<\/li>\n<li>CONNECT<\/li>\n<li>CREATE<\/li>\n<li>CURRENT<\/li>\n<li>DATE<\/li>\n<li>DECIMAL<\/li>\n<li>DEFAULT<\/li>\n<li>DELETE<\/li>\n<li>DESC<\/li>\n<li>DISTINCT<\/li>\n<li>DROP<\/li>\n<li>ELSE<\/li>\n<li>EXCLUSIVE<\/li>\n<li>EXISTS<\/li>\n<li>FILE<\/li>\n<li>FLOAT<\/li>\n<li>FOR<\/li>\n<li>FROM<\/li>\n<li>GRANT<\/li>\n<li>GROUP<\/li>\n<li>HAVING<\/li>\n<\/ul>\n<\/div><\/div><\/div><\/div><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><ul>\n<li>IDENTIFIED<\/li>\n<li>IMMEDIATE<\/li>\n<li>IN<\/li>\n<li>INCREMENT<\/li>\n<li>INDEX<\/li>\n<li>INITIAL<\/li>\n<li>INSERT<\/li>\n<li>INTEGER<\/li>\n<li>INTERSECT<\/li>\n<li>INTO<\/li>\n<li>IS<\/li>\n<li>LEVEL<\/li>\n<li>LIKE<\/li>\n<li>LOCK<\/li>\n<li>LONG<\/li>\n<li>MAXEXTENTS<\/li>\n<li>MINUS<\/li>\n<li>MLSLABEL<\/li>\n<li>MODE<\/li>\n<li>MODIFY<\/li>\n<li>NOAUDIT<\/li>\n<li>NOCOMPRESS<\/li>\n<li>NOT<\/li>\n<li>NOWAIT<\/li>\n<li>NULL<\/li>\n<li>NUMBER<\/li>\n<li>OF<\/li>\n<li>ONLINE<\/li>\n<li>ON<\/li>\n<li>OFFLINE<\/li>\n<li>OPTION<\/li>\n<li>ON<\/li>\n<li>ORDER<\/li>\n<li>PCTFREE<\/li>\n<li>PRIOR<\/li>\n<li>PRIVILEGES<\/li>\n<li>PUBLIC<\/li>\n<\/ul>\n<\/div><\/div><\/div><\/div><div class=\"wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_text_column\"><div class=\"wpb_wrapper\"><ul>\n<li>RAW<\/li>\n<li>RENAME<\/li>\n<li>RESOURCE<\/li>\n<li>REVOKE<\/li>\n<li>ROW<\/li>\n<li>ROWID<\/li>\n<li>RONUM<\/li>\n<li>ROWS<\/li>\n<li>SELECT<\/li>\n<li>SESSION<\/li>\n<li>SET<\/li>\n<li>SHARE<\/li>\n<li>SIZE<\/li>\n<li>SMALLINT<\/li>\n<li>START<\/li>\n<li>SUCCESSFUL<\/li>\n<li>SYNONYM<\/li>\n<li>SYSDATE<\/li>\n<li>TABLE<\/li>\n<li>THEN<\/li>\n<li>TO<\/li>\n<li>TRIGGER<\/li>\n<li>UID<\/li>\n<li>UNION<\/li>\n<li>UNIQUE<\/li>\n<li>UPDATE<\/li>\n<li>USER<\/li>\n<li>VALIDATE<\/li>\n<li>VALUES<\/li>\n<li>VARCHAR<\/li>\n<li>VARCHAR2<\/li>\n<li>VIEW<\/li>\n<li>WHENEVER<\/li>\n<li>WHERE<\/li>\n<li>WITH<\/li>\n<\/ul>\n<\/div><\/div><\/div><\/div><\/div><div class=\"w-separator size_small with_line width_default thick_1 style_solid color_border align_center\"><div class=\"w-separator-h\"><\/div><\/div><\/div><\/div><\/div><\/div><\/section>\n","protected":false},"excerpt":{"rendered":"From the Data tab of the Bot Builder Landing Page, click\u00a0Create Data Tables to create a data table. Creation Create Data Table would open\u00a0New Table page where you have to enter the following details: Name of the Data Table; Description of the Data Table; Columns to be included in the Table; Indexes for the Table;...","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29221"}],"collection":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/comments?post=29221"}],"version-history":[{"count":6,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29221\/revisions"}],"predecessor-version":[{"id":29231,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/posts\/29221\/revisions\/29231"}],"wp:attachment":[{"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/media?parent=29221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/categories?post=29221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multisite.korebots.com\/v9-0\/wp-json\/wp\/v2\/tags?post=29221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}