Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
cpomeren003
Partner - Creator II
Partner - Creator II

On demand app generation keeps failing on data load of template app

Hi everyone,

I am trying to use the ODAG functionality in Qlik Sense. Problem is,  it keeps failing when the on demand app gets generated and it just keeps failing when it tries loading data.

To fix this I have tried the following tutorials:

Unfortunately none of these work and I have tried everything I could think of. In the end I tried generating an almost empty app with just an inline table and even that didn't work... The bizarre thing is, if I go to the generated app that gives an error and manually reload it, it does work. 

Does anyone have any idea what I am doing wrong? Or have any ideas I can try? Or maybe have some example code that does work for you?

Extra information:

  • Server version: Qlik Sense April 2019 Patch 1
  • Security access: complete access / god mode in this test environment

Thanks in advance

Labels (1)
  • ODAG

10 Replies
cpomeren003
Partner - Creator II
Partner - Creator II
Author

In the weekend I tried some new things:

I also decided to completely remake my selection app and template app, so that I could share my code. Unfortunately it still doesn't work, so any help is appreciated.

Here is all my code for the selection app and the template app:

Selection app script:
Tab "Fact":

FactTable:
LOAD
    ProductKey,
    CustomerKey,
    sum(OrderQuantity) as OrderQuantity,
    sum(DiscountAmount) as DiscountAmount,
    sum(SalesAmount) as SalesAmount,
    sum(TaxAmt) as TaxAmt,
    sum(Freight) as Freight,
    Year(OrderDate) as OrderYear,
    Month(OrderDate) as OrderMonth,
    Year(ShipDate) as ShipYear,
	Month(ShipDate) as ShipMonth
FROM [lib://AttachedFiles/InternetSales_Fact.qvd]
(qvd)
GROUP By
	ProductKey,
	CustomerKey,
	Year(OrderDate),
    Month(OrderDate),
    Year(ShipDate),
	Month(ShipDate);


Tab "Dimensional Data":

LOAD
    CustomerKey,
    GeographyKey,
    Title,
    FirstName,
    LastName,
    BirthDate,
    MaritalStatus,
    Suffix,
    Gender,
    EmailAddress,
    YearlyIncome,
    TotalChildren,
    Occupation
FROM [lib://AttachedFiles/Customers.qvd]
(qvd);

LOAD
    ProductKey,
    ProductSubcategoryKey,
    ProductName,
    "Color",
    ListPrice,
    Size,
    Weight,
    DaysToManufacture
FROM [lib://AttachedFiles/Products.qvd]
(qvd);

LOAD
    ProductSubcategoryKey,
    ProductSubcategoryName
FROM [lib://AttachedFiles/ProdSubCategory.qvd]
(qvd);

LOAD
    GeographyKey,
    City,
    StateProvinceCode,
    StateProvinceName,
    CountryRegionCode,
    CountryRegionName,
    PostalCode
FROM [lib://AttachedFiles/Geography.qvd]
(qvd);


Template app script:
Tab "Dynamic Data":

// DO NOT ALTER THIS SUBROUTINE
SUB ExtendWhere(Name, ValVarName)
  LET T = Name & '_COLNAME';
  LET ColName = $(T);
  LET Values = $(ValVarName);
  IF len(Values) > 0 THEN
        IF len(WHERE_PART) > 0 THEN
        LET WHERE_PART = '$(WHERE_PART) AND mixmatch([$(ColName)],$(Values) )';
    ELSE
        LET WHERE_PART = ' WHERE mixmatch([$(ColName)],$(Values))';
    ENDIF
  ENDIF
END SUB;

// DO NOT ALTER THIS SUBROUTINE
SUB BuildValueList(VarName, TableName, ColName, QuoteChrNum)
  IF ($(QuoteChrNum) = 0) THEN
    LET LOADEXPR = 'Concat($(ColName),' & chr(39) & ',' & chr(39) & ') AS CombinedData';
  ELSE
    LET CHREXPR = ' chr(' & '$(QuoteChrNum)' & ') ';
    LET LOADEXPR = 'Concat( $(CHREXPR) & $(ColName) & $(CHREXPR)' & ',' & chr(39) & ',' & chr(39) & ') AS CombinedData';
  ENDIF
  _TempTable:
  LOAD $(LOADEXPR) Resident $(TableName);
  Let vNoOfRows = NoOfRows('_TempTable');
  IF $(vNoOfRows)> 0 THEN
    LET $(VarName) = Peek('CombinedData',0,'_TempTable');
  ENDIF
  drop table _TempTable;
  drop table '$(TableName)';
END SUB;

SET WHERE_PART = '';

SET ProductKey ='';
OdagBinding:
LOAD * INLINE [
VAL
$(odso_ProductKey){"quote": "", "delimiter": ""}
];
SET ProductKey_COLNAME='ProductKey';
CALL BuildValueList('ProductKey', 'OdagBinding', 'VAL', 39);		// 39 is for single quote wrapping values

SET CustomerKey ='';
OdagBinding:
LOAD * INLINE [
VAL
$(odso_CustomerKey){"quote": "", "delimiter": ""}
];
SET CustomerKey_COLNAME='CustomerKey';
CALL BuildValueList('CustomerKey', 'OdagBinding', 'VAL', 39);		// 39 is for single quote wrapping values

FOR EACH fldname IN 'ProductKey', 'CustomerKey'
  LET vallist = $(fldname);
  WHEN (IsNull(vallist)) LET vallist = '';
  IF len(vallist) > 0 THEN
    CALL ExtendWhere('$(fldname)','vallist');
  ENDIF
NEXT fldname

TRACE Generated WHERE clause: ;
TRACE $(WHERE_PART);


Tab "Fact":

FactTable:
LOAD
    ProductKey,
    CustomerKey,
    SalesOrderNumber,
    SalesOrderLineNumber,
    OrderQuantity,
    DiscountAmount,
    SalesAmount,
    TaxAmt,
    Freight,
    OrderDate,
    ShipDate
FROM [lib://AttachedFiles/InternetSales_Fact.qvd]
(qvd)
$(WHERE_PART);


Tab "Dimensional Data":

LOAD
    CustomerKey,
    GeographyKey,
    Title,
    FirstName,
    LastName,
    BirthDate,
    MaritalStatus,
    Suffix,
    Gender,
    EmailAddress,
    YearlyIncome,
    TotalChildren,
    Occupation
FROM [lib://AttachedFiles/Customers.qvd]
(qvd)
WHERE EXISTS(CustomerKey);

LOAD
    ProductKey,
    ProductSubcategoryKey,
    ProductName,
    Color,
    ListPrice,
    Size,
    Weight,
    DaysToManufacture
FROM [lib://AttachedFiles/Products.qvd]
(qvd)
WHERE EXISTS(ProductKey);

LOAD
    ProductSubcategoryKey,
    ProductSubcategoryName
FROM [lib://AttachedFiles/ProdSubCategory.qvd]
(qvd);

LOAD
    GeographyKey,
    City,
    StateProvinceCode,
    StateProvinceName,
    CountryRegionCode,
    CountryRegionName,
    PostalCode
FROM [lib://AttachedFiles/Geography.qvd]
(qvd);


When I use the App Navigation Link inside my selection app everything goes great till it reaches status: "loading" and then it goes to status: "failed". When I open the generated app it contains no data. I also tried looking into the logs, but I haven't found anything interesting.

All files mentioned in script can be found here:
https://support.qlik.com/articles/000045642?_ga=2.206967578.849473933.1574004650-1142306390.15317691... 

Unrelated question: Does anyone have the example mentioned here:

There are sample on-demand selection and template apps included in the Qlik Sense Enterprise installation at ProgramData\Qlik\Examples\OnDemandApp\sample.

Because I can't seem to find this.

@Ian_Crosland You were mentioned on slack as being the expert on ODAG, any chance you could help with this?

Ian_Crosland
Employee
Employee

Can you post the script log from here :

C:\ProgramData\Qlik\Sense\Log\Script

for the failed detail app load

cpomeren003
Partner - Creator II
Partner - Creator II
Author

Uhm, I can't really give these logs yet, because they are in a protected front-end environment and I need to formally request them. I will update this post as soon as I get them. 

So to circumvent this, I basically pushed my selection app and template app to the back-end environment, where I do have access to the logs. Problem is, I get a totally different error on the back-end. 

The error happens when I press "Generate New App" and says: "Cannot Connect To On-Demand App Service".
In the OdagService logs it says the following:

74	20191118T152925.857+01:00	ServerName	3.6.1	PreRequestHandler	INFO	API-ENTRY [20, cc123c1f-3d63-4c37-9b00-66402e292e7e, UserName]:	GET	/v1/links/e9e7ff01-a123-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=csAu2d3WLLLioYc1
75	20191118T152926.036+01:00	ServerName	3.6.1	PreRequestHandler	INFO	API-EXIT [20]:	200
76	20191118T152929.164+01:00	ServerName	3.6.1	PreRequestHandler	INFO	API-ENTRY [21, cc123c1f-3d63-4c37-9b00-66402e292e7e, UserName]:	POST	/v1/links/e9e7ff01-123-45aa-a702-4b08714bc686/requests?xrfkey=FrccJJRYmuUxBny6
77	20191118T152929.731+01:00	ServerName	3.6.1	EngineRpc	INFO	API-ID [21]:	setupConnection:	Opening app d84810d6-eefe-4e80-8001-bad9e3f3dfb4 in serverLocation
78	20191118T152948.895+01:00	ServerName	3.6.1	EngineRpc	ERROR	API-ID [21]:	setupConnection: ODAG-ERR-1101: EngineResponseError: EngineRpc.setupConnection: read ECONNRESET
79	20191118T152948.895+01:00	ServerName	3.6.1	EngineRpc	ERROR	API-ID [21]:	getAppScript: ODAG-ERR-1101: EngineResponseError: EngineRpc.getAppScript: EngineRpc.setupConnection: read ECONNRESET
80	20191118T152948.895+01:00	ServerName	3.6.1	EngineRpc	ERROR	API-ID [21]:	getAppScript: ODAG-ERR-1101: EngineResponseError: EngineRpc.getAppScript: EngineRpc.getAppScript: EngineRpc.setupConnection: read ECONNRESET
81	20191118T152948.896+01:00	ServerName	3.6.1	PreRequestHandler	INFO	API-EXIT [21]:	500

 Is it smarter to just wait on the front-end logs? Or should I try to fix both?

Ian_Crosland
Employee
Employee

This issue should have been fixed in the version you have, a few steps outlined here to check:

 

https://support.qlik.com/articles/000056365?_ga=2.17239481.1206714028.1574073266-1194729353.15392555...

cpomeren003
Partner - Creator II
Partner - Creator II
Author

Sorry it took so long to respond, but I wanted to double check everything I have done.

This issue should have been fixed in the version you have

It seems it can still happen and I am the only one that is currently working with ODAG and as far as I know I haven't done any 'very large ODAG request's'. I'll follow the resolution posted in that support article. This error only occurs on the back-end, so it isn't as important compared to my error in the front-end.

I have also received the log files from the front-end. So I requested all the log files from:

C:\ProgramData\Qlik\Sense\Log\Script

But these logs didn't contain anything regarding my error. I basically timestamped all my attempts where the error happened and none of these attempts showed up in the script logs.

So I thought maybe I requested the wrong long files and thus I requested every log they could find. This means I now have access to the following logs:

  • AboutService
  • AppDistributionService
  • AppMigration
  • BrokerService
  • CapabilityService
  • ConnectorRegistryProxy
  • ConverterService
  • DataProfiling
  • DepGraphService
  • DeploymentBasedWarningsService
  • DownloadPrepService
  • Engine
  • HubService
  • HybridDeploymentService
  • HybridSetupConsoleBff
  • Licenses
  • OdagService
  • PrecedentsService
  • Printing
  • Proxy
  • Repository
  • ResourceDistributionService
  • Scheduler
  • Script
  • WebExtensionService

I tried looking in these logs for my timestamped event where I received the errors and I found it in the log of OdagService. It contained the following:

1130	20191118T135114.652+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [392, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	POST	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?xrfkey=QD35gnBhGrQhxNfN
1131	20191118T135117.828+01:00	server-name	3.6.1	EngineRpc	INFO	API-ID [392]:	setupConnection:	Opening app d84810d6-eefe-4e80-8001-bad9e3f3dfb4 in server-name:4747
1132	20191118T135121.772+01:00	server-name	3.6.1	RequestService	INFO	API-ID [392]:	submitRequest: NEW-OBJECT [request : 133fb37c-3f25-4583-8b20-53ac5e6440f4]
1133	20191118T135121.773+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [392]:	201
1134	20191118T135121.974+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [393, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=TOyoUFEzvflwjaaA
1135	20191118T135122.127+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: started
1136	20191118T135122.725+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: ODAG request accessed, setting to state 'validating'
1137	20191118T135122.900+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [393]:	200
1138	20191118T135123.692+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: accessing link 'e9e7ff01-a435-45aa-a702-4b08714bc686'
1139	20191118T135124.160+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	generateScript: accessing script of link template app 'd84810d6-eefe-4e80-8001-bad9e3f3dfb4'
1140	20191118T135124.846+01:00	server-name	3.6.1	EngineRpc	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	setupConnection:	Opening app d84810d6-eefe-4e80-8001-bad9e3f3dfb4 in server-name:4747
1141	20191118T135126.044+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [394, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=ozPDt191OnCayUHf
1142	20191118T135126.921+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [394]:	200
1143	20191118T135127.555+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	generateScript: accessed script of link template app 'e9e7ff01-a435-45aa-a702-4b08714bc686'
1144	20191118T135127.556+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: templateApp script is bindable, duplicating template app.
1145	20191118T135128.086+01:00	server-name	3.6.1	QrsRest	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	duplicateApp:Duplicating app d84810d6-eefe-4e80-8001-bad9e3f3dfb4 in server-name
1146	20191118T135130.127+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [395, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=lSLYraSIwpNz5xOu
1147	20191118T135131.016+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [395]:	200
1148	20191118T135134.096+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [396, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=nPF1eS7BZSWVnFti
1149	20191118T135135.036+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [396]:	200
1150	20191118T135138.115+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [397, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=WBHCd8C0D3JpBBgZ
1151	20191118T135138.990+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [397]:	200
1152	20191118T135142.073+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [398, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=hA0m1BBSwqiGIPxH
1153	20191118T135143.005+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [398]:	200
1154	20191118T135146.091+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [399, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=EPIrfDKP77u6P68Z
1155	20191118T135146.978+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [399]:	200
1156	20191118T135150.233+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [400, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=ylMjvUpoYHfZ8xSc
1157	20191118T135150.365+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: generated app script set, changing request state to 'loading'
1158	20191118T135151.174+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [400]:	200
1159	20191118T135151.815+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	reloadRequestGenApp: invoking reload on generated app dac17dee-330e-444d-b0dc-266b092d506f
1160	20191118T135152.868+01:00	server-name	3.6.1	EngineRpc	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	setupConnectionForReload:	Opening app dac17dee-330e-444d-b0dc-266b092d506f in servername:port
1161	20191118T135154.251+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [401, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=EF41QloYB1ywBcZ4
1162	20191118T135155.272+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [401]:	200
1163	20191118T135157.627+01:00	server-name	3.6.1	EngineRpc	ERROR	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	setupConnectionForReload: ODAG-ERR-1101: EngineResponseError: EngineRpc.setupConnectionForReload: read ECONNRESET
1164	20191118T135157.628+01:00	server-name	3.6.1	RequestProcessor	ERROR	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	runRequest: reload failed: EngineResponseError: EngineRpc.setupConnectionForReload: read ECONNRESET
1165	20191118T135158.360+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-ENTRY [402, 1668e588-a610-4efa-a00d-5764b3a79fa6, IAM\UserName]:	GET	/v1/links/e9e7ff01-a435-45aa-a702-4b08714bc686/requests?pending=true&xrfkey=LofHBNTFqSonzLvx
1166	20191118T135158.985+01:00	server-name	3.6.1	RequestProcessor	INFO	API-ID [133fb37c-3f25-4583-8b20-53ac5e6440f4]:	setRequestFinalState: Set final state of request '133fb37c-3f25-4583-8b20-53ac5e6440f4' to 'failed'
1167	20191118T135159.288+01:00	server-name	3.6.1	PreRequestHandler	INFO	API-EXIT [402]:	200

 Does this help? Or do you need any other logs? Or is this error connected with the error I encountered in my back-end?

Thanks in advance

Ian_Crosland
Employee
Employee

Thanks for posting, everything you have posted in terms of the script and setup looks ok from my perspective, it appears to be a comms issue with the ODAG service itself, at this stage could you raise a support ticket who can progress this much further with additional diagnostics

 

Thanks 

 

Ian

cpomeren003
Partner - Creator II
Partner - Creator II
Author

Will do, thanks for the help! I will update this post if I have found a solution.

Have a nice weekend!

kevin1
Partner - Contributor II
Partner - Contributor II

Hello cpomeren003,

Did you find a solution?

regards

LCauch
Contributor III
Contributor III

I'm interested as well if you have a solution.

Regards,