Closed rvaheldendaten closed 3 years ago
Do the new measures appear if: 1) You refresh the app with F5? 2) You close and re-open the app?
Hi! Close and re-open the app helped! Great! Now they are all visible!
This is a limitation of the technique. The SSE creates the Measures in a different session so the QS UI does not see them until the app is reopened from disk.
Hi Rob! As mentioned on your blog, here my findings when testing the "Create" methods on my Qlik Sense Sept 2020 Windows Server.
I took the measure creation from your example and created a new Qlik Sense App.
Measures: LOAD , QCB.CreateMeasure(MeasureName, MeasureDef, 'description', 'tags', 'label') as MeasureStatus Inline [ MeasureName, MeasureDef TotalSales, "Sum(Sales)" Biggest Product Fail, "FirstSortedValue(Sales, max(sum(Sales), Product))" Biggest Product, "FirstSortedValue(Product, -aggr(sum(Sales), Product))" Margin Pct, "Sum(Margin) / Sum(Sales)" Average Sale, "Avg(sales)" Seasonal Sales, "Summer(foo)" Commission, "Sum(Sales) .08" ] ;
After Script Run the Measures don't show up in the Qlik Sense frontend. I created a Measure manually in the frontend. This works as expected.
I then rerun the script and did a
TempId: load '6c33b402-43b9-4d47-919b-af253c185cd0' as AppId autogenerate(1);
LoadedMeasures: Load * Extension QCB.GetMeasures(TempId{AppId});
This returns me a 8 Measures --> the 7 measures from your QCB-Example and the one created manually . So it seems the measures are somehow stored in the .qvf, but not shown on the Frontend.
Same issue with QCB.CreateMeasureFromProperties and QCB.CreateDimension
Here the JSON for a measure created by QCB (result of QCB.GetMeasures)
`
{"qInfo":{"qId":"4dd5eab2-cb25-457d-8ddd-4c45f7e5c3e6","qType":"measure"},"qMeasure":{"qLabel":"Average Sale","qDef":"Avg(sales)","qGrouping":"N","qExpressions":[],"qActiveExpression":0,"qLabelExpression":"label","qNumFormat":{"qType":"U","qnDec":10,"qUseThou":0}},"qMetaDef":{"title":"Average Sale","description":"description","tags":["tags"]}}
`
Here the measure created on the frontend `
{"qInfo":{"qId":"FWxyC","qType":"measure"},"qMeasure":{"qLabel":"Manualmeasure","qDef":"sum(100)","qGrouping":"N","qExpressions":[],"qActiveExpression":0,"qLabelExpression":"='MyMeasure'","qNumFormat":{"qType":"U","qnDec":10,"qUseThou":0},"coloring":{"baseColor":{"color":"#f8981d","index":9}}},"qMetaDef":{"title":"Manualmeasure","description":"Created on Frontend","tags":["$frontendtag"]}}
`
Not quite sure what makes the difference. To me most notable is "qID". It's 'FWxyC' for the manually generated measure, but its a GUID for the QCB Measures.
Thx, Roland