InfoVizion Expression Editor, part two

After writing previous post I have very interesting discussion with Jason Michaelides.

Jason raised perfectly valid question about performance considerations of using = sign in variable definition. In my example I use it with dynamic labels and comments. Actually I never used sort of internalization similar to my sample and almost all labels and comments in our applications are pretty static. So after some thought and some unsuccessful attempts to make it work differently I gave up. Approach in my example is pretty and uniform but now I think I would still use it only for couple or at most dozen of labels for entire application. In case I would need actual internalization where all labels and comments should be 100% dynamic I would probably prefer variable definition without = sign with consecutive dollar sign expansion in chart expression’s labels and comments. So for AvgOrder in Expression editor it would be like:

SET: AvgOrder
Definition: Sum(Quantity*UnitPrice)/Count(DISTINCT OrderID)
Label: If($(russianNotSelected),'Avg order value','Средний чек')
Comment: If($(russianNotSelected),'Avg order value','Средний чек')

And in chart expression Label would be set to =$(AvgOrder.Label) and Comment to =$(AvgOrder.Comment) Looks slightly worse for my eyes but it probably worth it.

Another interesting point in Jason’s article and consecutive conversation was Jason’s overall approach to application modeling.

I think most frequently used technique currently is maintaining of chart expression formulas in external database (mostly excel table). Then chart formulas are loaded into applications as variables by load script or macro. Maintaining of labels and comments are discussed less frequently but for me it is obvious that they should be stored along with formulas. If formulas stored in table, labels and comments should be columns of that table. In our previous projects we loaded expression names, labels and comments into application as an isle table and used them in UI through dollar sigh expansion with parameter: =$(GetLabel('Sale')) for example.

As I understand it from that middle ground we and Jason move into opposite directions. Now we load all stuff - formulas definitions, labels, comments and so on - into variables and Jason use all, including formulas definitions itself directly from that isle table. Viewing from that perspective both techniques are somewhat radical.

I prefer our approach anyway, but obviously it is very personal choice and other variants are perfectly useful too. So I’ve added new output format (tabular comma separated file) to Expression Editor. For example I switch output format at Preferences->Package Settings->InfoVizion-Tools->QlikView variable file settings: User to CVS and save expressions file CustomVariables.qlikview-vars in sample project. I see in same directory autogenerated file CustomVariables.table.csv with contents:

Sales,Sales,Sales amount for selected period,,,Sum(Quantity*UnitPrice)
Sales1998,1998,Sales 1998,,,"Sum(If(Year(OrderDate)=1998, Quantity*UnitPrice))"
Sales1997,1997,Sales 1997,,,"Sum(If(Year(OrderDate)=1997, Quantity*UnitPrice))"
Sales1998to1997,Sales Index 98/97,Ratio for sales 1998 to 1997 years,,,($(Sales1998)/$(Sales1997))
AvgOrder,Avg order value,Avg order value,,,Sum(Quantity*UnitPrice)/Count(DISTINCT OrderID)
NoOfOrders,No of orders,Number of orders,,,Count (Distinct OrderID)

So in that output format each row contains name, definition, label, comment and some additional metadata. With that format added I think Expression Editor may be used in environments different from ours own.

InfoVizion Expression Editor in QlikView Deployment Framework environment

comments powered by Disqus