Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to Creating dynamc adHOC analysıs in QV by the code written below; but it gives an error, I am missing a point where it is I couldnt find.
Script | Syntax Error |
---|---|
Set HidePrefix='%'; //Set the Hide Prefix //Load the list of Dimensions DimensionList: LOAD * Inline[ %Dimensions15 SalesPerson15 Country15 City15 Product15 ]; //load the list of expressions ExpressionList: load * Inline [ %ExpressionName15 TotalSales15 OrderCount15 AvgSales15 ]; //load the sales data Data: LOAD * Inline [ SalesPerson15, Country15, City15, Product15, Sales15, Orders15 Joe, Germany, Berlin, Bricks, 129765, 399 Joe, Germany, Berlin, Brogues, 303196, 5842 Joe, Germany, Berlin, Widgets, 64358, 1603 Joe, Germany, Berlin, Woggles, 120587, 670 Joe, Germany, Frankfurt, Bricks, 264009, 2327 Joe, Germany, Frankfurt, Brogues, 369565, 3191 Joe, Germany, Frankfurt, Widgets, 387441, 5331 Joe, Germany, Frankfurt, Woggles, 392757, 735 Joe, Germany, Munich, Bricks, 153952, 1937 Joe, Germany, Munich, Brogues, 319644, 645 Joe, Germany, Munich, Widgets, 47616, 2820 Joe, Germany, Munich, Woggles, 105483, 3205 Brian, Japan, Osaka, Bricks, 17086, 281 Brian, Japan, Osaka, Brogues, 339902, 2872 Brian, Japan, Osaka, Widgets, 148935, 1864 Brian, Japan, Osaka, Woggles, 142033, 2085 Brian, Japan, Tokyo, Bricks, 161972, 1707 Brian, Japan, Tokyo, Brogues, 387405, 2992 Brian, Japan, Tokyo, Widgets, 270573, 3212 Brian, Japan, Tokyo, Woggles, 134713, 5522 Brian, Japan, Yokohama, Bricks, 147943, 4595 Brian, Japan, Yokohama, Brogues, 405429, 6844 Brian, Japan, Yokohama, Widgets, 266462, 3158 Brian, Japan, Yokohama, Woggles, 477315, 5802 Joe, UK, Birmingham, Bricks, 23150, 1754 Joe, UK, Birmingham, Brogues, 200568, 1763 Joe, UK, Birmingham, Widgets, 262824, 617 Joe, UK, Birmingham, Woggles, 173118, 5359 Joe, UK, London, Bricks, 621409, 712 Joe, UK, London, Brogues, 504268, 2873 Joe, UK, London, Widgets, 260335, 1313 Joe, UK, London, Woggles, 344435, 743 Joe, UK, Manchester, Bricks, 401928, 1661 Joe, UK, Manchester, Brogues, 7366, 2530 Joe, UK, Manchester, Widgets, 6108, 5106 Joe, UK, Manchester, Woggles, 269611, 4344 Mary, USA, Boston, Bricks, 442658, 3374 Mary, USA, Boston, Brogues, 147127, 3129 Mary, USA, Boston, Widgets, 213802, 1604 Mary, USA, Boston, Woggles, 395072, 1157 Michael, USA, Dallas, Bricks, 499805, 3378 Michael, USA, Dallas, Brogues, 354623, 18 Michael, USA, Dallas, Widgets, 422612, 2130 Michael, USA, Dallas, Woggles, 217603, 2612 Mary, USA, New York, Bricks, 313600, 6468 Mary, USA, New York, Brogues, 559745, 1743 Mary, USA, New York, Widgets, 94558, 2910 Mary, USA, New York, Woggles, 482012, 3173 Michael, USA, San Diego, Bricks, 95594, 4214 Michael, USA, San Diego, Brogues, 24639, 3337 Michael, USA, San Diego, Widgets, 107683, 5257 Michael, USA, San Diego, Woggles, 221065, 5058 ] ; | Syntax error, missing/misplaced FROM: DimensionList: LOAD * Inline[ %Dimensions15 SalesPerson15 Country15 City15 Product15 ] DimensionList: LOAD * Inline[ %Dimensions15 SalesPerson15 Country15 City15 Product15 ] |
add a space after inline to
LOAD * Inline[
it should be
LOAD * Inline [
Simple
There should be space between Inline and opening [ bracket
To avoid the above problem, do the below
Edit Script > Insert Menu > Load Statement > Load Inline
By doing above you will not get syntax errors in this case
Thanks
Thank you so much, but there is still a problem on the chart side.
The chart says; "All expressions disabled" although I apply the all steps correctly.
also the steps,I applied;
These steps show you how to create dynamic ad hoc analysis in QlikView:
Dimension | Expression |
Country | =Alt( WildMatch( GetFieldSelections(%Dimensions, '|'), '*Country*') ,0) |
City | =Alt( WildMatch( GetFieldSelections(%Dimensions, '|'), '*City*') ,0) |
Product | =Alt( WildMatch( GetFieldSelections(%Dimensions, '|'), '*Product*') ,0) |
SalesPerson | =Alt( WildMatch( GetFieldSelections(%Dimensions, '|'), '*SalesPerson*') ,0) |
Expression | Conditional Expression |
Sum(Sales) | =Alt( WildMatch( GetFieldSelections( %ExpressionName, '|'), '*Total Sales*') , 0) |
Sum(Orders) | =Alt( WildMatch( GetFieldSelections( %ExpressionName, '|'), '*Order Count*') , 0) |
Sum(Sales)/ Sum(Orders) | =Alt( WildMatch( GetFieldSelections( %ExpressionName, '|'), '*Avg. Sales*') , 0) |
your dimension field is %Dimension15; in the expression you used %Dimension, not the same field
The value is Country15, in the expression you used Country
DimensionList:
LOAD * Inline[
%Dimensions15
SalesPerson15
Country15
City15
Product15
];
=Alt( WildMatch( GetFieldSelections(%Dimensions, '|'), '*Country*') ,0)
the same for expressions
ExpressionList:
load * Inline [
%ExpressionName15
TotalSales15
OrderCount15
AvgSales15
];
=Alt( WildMatch( GetFieldSelections( %ExpressionName, '|'), '*Total Sales*') , 0)
No sorry, It is copy from the book (originally) but I re-named the fields, ın my scipt all are the same name as you said.
try the attachment
This one is easy. When I tried the simple one similar to yours, it run as well. The one,on the attachment, I tried to do is more complex for me,
I attached the QV document that I tried,
Could you please check the chart?
Please let me know where I do a mistake.
see attachment for chart 15 - Sales Analysis
In the conditional expression TotalSales, not Total Sales
In the conditional dimension Country15 not Country