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 QvxTable GetData(ScriptCode script, ConnectorParameter parameter) { try { var qlikApp = AppInstance.GetQlikInstance(parameter, script.AppId); if (qlikApp == null) { return(new QvxTable()); } foreach (var filter in script.Filter) { logger.Debug($"Filter: {filter}"); foreach (var value in filter.Values) { logger.Debug($""); var result = qlikApp.FirstSession.Selections.SelectValue(filter.Name, value); if (result == false) { logger.Error($"The Dimension \"{filter.Name}\" could not found."); return(null); } } } var resultTable = tableFunctions.GetTableInfosFromApp($"Table_{script.AppId}_{script.ObjectId}", script, parameter, qlikApp); return(resultTable.QvxTable); } catch (Exception ex) { logger.Error(ex, "The table script can not be executed."); return(new QvxTable()); } }
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 ResultTable GetData(ScriptCode script, UserParameter parameter) { q2gconhypercubemain.Connection connection = null; try { var config = QlikApp.CreateConfig(parameter, script.AppId); var qlikApp = new QlikApp(parameter); connection = qlikApp.CreateNewConnection(config); if (!connection.Connect()) { return(null); } foreach (var filter in script.Filter) { logger.Debug($"Filter: {filter}"); foreach (var value in filter.Values) { var selection = new QlikSelections(connection.CurrentApp); var result = selection.SelectValue(filter.Name, value); if (result == false) { logger.Error($"The Dimension \"{filter.Name}\" could not found."); return(null); } } } var resultTable = tableFunctions.GetTableInfosFromApp($"Table_{script.AppId}_{script.ObjectId}", script, connection.CurrentApp); return(resultTable.QvxTable); } catch (Exception ex) { logger.Error(ex, "The table script can not be executed."); return(null); } finally { connection?.Close(); } }