во встроенной панели управления ibm cognos функция добавления источников принимает объект модуля, который имеет определение или схему файла csv, который вы используете в качестве источника данных, в моем случае пользователи будут загружать свои собственные файлы csv, так какЯ генерирую их схему автоматически и передаю ее функции addSource?
dashboardAPI.addSources([{
module: sampleModule,
name: 'Survey sample',
id: 'myUniqueId789'
}])
sampleModule = {
"xsd":"https://ibm.com/daas/module/1.0/module.xsd",
"source": {
"id": "StringID",
"srcUrl": {
"sourceUrl": 'https://developer.ibm.com/static/site-id/141/ddeCSVSample.csv',
"mimeType": "text/csv",
"property": [
{
"name": "headers",
"value": [
{
"name": "x-header-1",
"value": "someheadervalue"
},
{
"name": "x-header-2",
"value": "someotherheadervalue"
}
]
}
]
}
},
"table": {
"name": "TableName",
"column": [
{
"datatype": "BIGINT",
"nullable": true,
"name": "Year_",
"description": "Year",
"label": "Year",
"usage": "attribute",
"regularAggregate": "none",
"taxonomyFamily": "cYear"
},
{
"datatype": "NVARCHAR(20)",
"nullable": true,
"name": "Product_type",
"description": "Product type",
"label": "Product type",
"usage": "attribute",
"regularAggregate": "none"
},
{
"datatype": "NVARCHAR(17)",
"nullable": true,
"name": "Order_method_type",
"description": "Order method type",
"label": "Order method type",
"usage": "attribute",
"regularAggregate": "none"
},
{
"name": "Retailer_country",
"datatype": "NVARCHAR(16)",
"nullable": true,
"description": "Retailer country",
"label": "Retailer country",
"usage": "attribute",
"regularAggregate": "none",
"taxonomyFamily": "cCountry"
},
{
"datatype": "DOUBLE",
"nullable": true,
"name": "Revenue",
"description": "Revenue",
"label": "Revenue",
"usage": "fact",
"regularAggregate": "total"
},
{
"datatype": "DECIMAL(38, 0)",
"nullable": true,
"name": "Quantity",
"description": "Quantity",
"label": "Quantity",
"usage": "fact",
"regularAggregate": "total"
}
]
},
"label": "Module Name",
"identifier": "moduleId"
}