private QvDataContractResponse GetPreview(UserParameter parameter, string appId, string objectId) { q2gconhypercubemain.Connection connection = null; try { var oId = GetObjectId(objectId); if (String.IsNullOrEmpty(oId)) { throw new Exception("no object id for preview table found."); } var config = QlikApp.CreateConfig(parameter, appId); var qlikApp = new QlikApp(parameter); connection = qlikApp.CreateNewConnection(config); var script = ScriptCode.Create(appId, oId); var resultTable = tableFunctions.GetTableInfosFromApp("PreviewTable", script, connection.CurrentApp); if (resultTable == null) { throw new Exception("no preview table found."); } return(PreviewResponse.Create(resultTable.Preview)); } catch (Exception ex) { logger.Error(ex, $"fields from app {appId} and table {objectId} not loaded."); return(new PreviewResponse()); } finally { connection?.Close(); } }
private QvDataContractResponse GetFields(ConnectorParameter parameter, string appId, string objectId) { try { var oId = GetObjectId(objectId); if (String.IsNullOrEmpty(oId)) { throw new Exception("no object id for field table found."); } var script = ScriptCode.Create(appId, oId); var resultTable = tableFunctions.GetTableInfosFromApp("FieldTable", script, parameter); if (resultTable == null) { throw new Exception("no field table found."); } return(new QvDataContractFieldListResponse { qFields = resultTable.QvxTable.Fields }); } catch (Exception ex) { logger.Error(ex, $"fields from app {appId} and table {objectId} not loaded."); return(new QvDataContractFieldListResponse { qFields = new QvxField[0] }); } }
private QvDataContractResponse GetFields(UserParameter parameter, string appId, string objectId) { q2gconhypercubemain.Connection connection = null; using (MappedDiagnosticsLogicalContext.SetScoped("connectionId", connection?.ConnId)) { try { var oId = GetObjectId(objectId); if (String.IsNullOrEmpty(oId)) { throw new Exception("no object id for field table found."); } var script = ScriptCode.Create(appId, oId); var config = QlikApp.CreateConfig(parameter, appId); var qlikApp = new QlikApp(parameter); connection = qlikApp.CreateNewConnection(config); var resultTable = tableFunctions.GetTableInfosFromApp("FieldTable", script, connection.CurrentApp); if (resultTable == null) { throw new Exception("no field table found."); } var qvxTable = TableUtilities.ConvertTable(resultTable.QvxTable); return(new QvDataContractFieldListResponse { qFields = qvxTable.Fields }); } catch (Exception ex) { logger.Error(ex, $"fields from app {appId} and table {objectId} not loaded."); return(new QvDataContractFieldListResponse { qFields = new QvxField[0] }); } finally { connection?.Close(); } } }
private QvDataContractResponse GetPreview(ConnectorParameter parameter, string appId, string objectId) { try { var oId = GetObjectId(objectId); if (String.IsNullOrEmpty(oId)) { throw new Exception("no object id for preview table found."); } var script = ScriptCode.Create(appId, oId); var resultTable = tableFunctions.GetTableInfosFromApp("PreviewTable", script, parameter); if (resultTable == null) { throw new Exception("no preview table found."); } return(resultTable.Preview); } catch (Exception ex) { logger.Error(ex, $"fields from app {appId} and table {objectId} not loaded."); return(new TableFunc.PreviewResponse()); } }