Archive for the ‘LogiXML’ Category

LogiXML: Condition Vs Show Mode

August 10, 2010

I was developing a series of reports that allowed you to click through to: Year > Month > Week > Day > Hour > Minute. Came an idea. You know some of these drill through would do ok as standalone. I start adding the standalone parts to do the needed selections. I did Month and Week and noticed it looks pretty ugly having those input elements up there when I don’t want them when I come from another report. Plus since I’m loading those combo boxes with data from the SQL Server it does take a little bit more time for the report to show up. First thought, Show Modes.

LogiXML (Logi) has a property on most elements that is called simply “Show Modes”. For the elements that do not have it you stick them in a Div and set it on the Div. A show mode basically tells Logi what to show on the page. They are just a comma separated string of values telling what Modes an element can be shown in. If there are no modes indicated it will be shown in all modes. If “None” is indicate the element will never just show up on its own. The string of values is CasE SeNSitive and does not seem to ignore white space. How do you use a Show Mode?

When you call a report in LogiXML one of the parameters that can be passed is its show mode. In fact you can pass this with a series of display oriented actions such as exporting to PDF or Excel. Why would you want to do that? The pretty graph you made is probably not what a user is Exporting to Excel for. They want that DataTable you put on there that gives in number what your pretty graph says, conversely you could have the Excel export button call a different report that just is the DataTable to export if you are not showing it at all <Wave hand, Wave Hand>. Another example would be not showing the input elements on the PDF, Excel, or the Report at all as in my case. If you decide to use Show modes being consistent between reports will save you a bunch of headaches. In common I’ll use Web, PDF, Excel, and Print. Now back to the story at hand.

Show Mode great solution… and then the testing. Click, Click. Cool there not showing up on the Month. Click. Wait… Wait… This seems slower than it should be without the Input elements. Oh well, maybe it doesn’t work like I think it does. I’ll just remark them out at the moment. A few days later.

Checking the Logi Forums. Seeing if I got some answers or can help. Hey what’s this? Wait did this just say that Show Modes just hide things. It seems that Show Modes are done on the client side. Logi will do all the processing like everything will be displayed because everything very well could be and sends everything over. You’re really not gaining any performance from Show Modes. It’s purely visual in the end. Well that stinks but alas the post brought hope. Divs have a property called Condition.

What is a Condition? Think about an if statement without the If and brackets and that’s a Condition. A condition simply tells Logi when an element that has one will be displayed. If blank it will always be displayed, assuming the Show Modes or something else doesn’t hide it. A Condition can be VB Script or Javascript. Which you need to remember with working with Tokens because Tokens are just text substituted in to the expression aka VB Script or Javascript doesn’t know that Tom is not an int. You need to remember to double quote your strings for comparisons. “Wait a sec. Show Modes tells Logi when an element should be Hidden.” Correct but, Show Modes does that on the Client Side. Condition on the other hand happens on the Server Side. Why is that important? Let’s go back to my original problem.

I had a cool Drill Through Report that ran pretty fast until I put my SQL loaded input elements. I got rid of the generalization from the report to bring the speed back up in its main purpose. Being a developer I like to reuse things and in general I’m lazy, like Mathematicians and Physicists. Using Conditions I can bring the lazy back. Since it does it on the Server side Logi knows there isn’t any reason to do the work to obtain the objects in my Input Elements div if the condition doesn’t allow them to be shown. I guess Logi’s lazy as well :D. How did I take advantage of this modern marvel of Lazyness?

It was a simple. In the Condition Attribute of my Div I put in the code ”@Request.ShowInput~ == 1″. In my Default Parameter, if you don’t just add this to your reports I recommend it, I have ShowInput set to 1. This means that if I just run this report straight up the input elements will show. Now when I do my Drill Through I simply pass as a parameter ShowInput set to any number but 1, I use 0. You could even make this more granular if you like. Have different input elements in different divs and do a bit more complex logic.

In the end Show Modes hide items that are already to the client. They are done client side and are good for getting rid of or showing elements needed in the different modes of exports. Condition is server side and is good for data driven hiding and hiding taxing parts of your report that are not needed in the current flavor of the report.

Links:

Logi Documentation on Condition which I found after writing this pretty much an expanded version of this blog post.

The Documentation on Show Modes.

Division Documentation.

Documentation on Information Passing.

Export to Excel

Export to PDF

General Chart Documentation

Logi Forums

 

That should cover everything I mentioned.