Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dinamic Chart: is it useful?

Gives a possibilities to select Dimensions and Expressions for a chart. How often we fight with clients to reduce number of columns in a table. This is the solution. What do you think is it useful?

19 Replies
johnw
Champion III
Champion III

It's useful. I've had something similar in a production application for a couple years now, and have had users specifically ask for this feature in some newer applications. In my case, I define the expressions in the chart and just enable and disable them rather than adding and removing them. I believe I found that was faster than adding and removing, but it's been a long time since I've done any testing on those applications. For comparison, I've attached the template for what I do.

I think we both share a possible weakness - I believe that the server only keeps one copy of the chart, so if you have multiple users doing dynamic reporting at the same time, I think it can cause problems. However, it hasn't been a problem for us in practice, and apparently hasn't been for you either.

(Edit: Our intended solution to the "only one chart" problem was to create a hidden master template for the chart with all dimensions and columns, and then clone from there, and remove everything we didn't need, then allow it to calculate and be displayed. Everyone would then have a different chart, so there wouldn't be conflicts. We never implemented this since we haven't had problems in practice for a long long time.)

johnw
Champion III
Champion III

Hmmm, your macro is crashing out for me in both 8.5 and 9.0. It happens when we try to add the dimensions.

'add dimensions
set dimSelection = ActiveDocument.fields("%Dimension").GetSelectedValues
for i=0 to dimSelection.Count - 1
chart.AddDimension dimSelection.Item(i).Text <-- stops here with no error message
next

I remember having and then solving this exact same problem with my own macro when we upgraded to 8.5. However, I'm not seeing anything different in mine. I basically have the exact same loop as you:

for j = 0 to selectedDimensionMax 'add selected dimensions
chart.addDimension selectedDimensions.Item(j).Text
next

I can't remember how I fixed the problem. I remember that the issue was intermittent. I think Rob Wunderlich figured it out and fixed the macro for me. But now I'm not seeing any indication of what he did in my code comments.

HAH! I just crashed mine out the same as yours in 9.0 (we're still officially on 8.5). Guess we'll have to solve the problem again when we upgrade. Smile

Not applicable
Author


John Witherspoon wrote:
Hmmm, your macro is crashing out for me in both 8.5 and 9.0. It happens when we try to add the dimensions.


I've done it in 9.00.7320.7 SR2. And it works fine there. But I've decided to test on web server for multisession. The server version is 8.5. And I have the same problem. I'm trying to work it out. Super Angry

johnw
Champion III
Champion III

OK, I'm on the initial release of 9.0 since it's just the personal edition. I haven't bothered upgrading to SR2. That's probably a good sign that yours works in 9.0 SR2. Maybe I won't have to make changes to mine to get it up and running again. Let me check my old email. I'm betting that Rob explained what he did in email. Yes, here we are:


John,
If I understand the problem fully, I believe I have a workaround for #1. I did my testing on the DynamicReportTemplate.qvw and didn't test yet with your real apps. I was testing with 8.50.6231and can reproduce the problem.
The problem is that AddDimension throws the error when it's called on a hidden chart. I put an app in $Developer\bug\addDimension.qvw that demonstrates this.
I've created $Developer\$template\DynamicReportTemplate2.qvw as a suggested workaround.
For the hidden chart CH01, I removed the "and AllowCalculation=1" from the Show Condition. I also changed the field test from
"=not isNull(getFieldSelections([Expressions]))"
to
"=GetSelectedCount([Expressions]) > 0"
This last change is not related to the bug but with all the recent forum buzz about isNull() I find it to be a clearer expression.
This causes the chart to become visible as soon as selections are made -- which works around the AddDimension limitation (bug?). To achieve the visual effect of showing the "Please wait..." text object (TX07) while the chart is calculating, I made the TX07 object as big as the chart, background same as sheet color, no transparency and layer 99 to make sure it's on top. When it displays it completely obscures the chart beneath it.
TX07 visibility is still controlled by the AllowCalculation variable. To smooth out the visual transitions I moved the WaitForIdle to after the setting of AllowCalculation.
BTW, I changed the TableBox TB01 Show Condition to:
=getSelectedCount([Expressions]) = 0 and getSelectedCount([Dimensions]) > 0
just for consistency with the other Show condition change.
Let me know if you think these changes will work with your real apps or if you want me to do some further testing with your other apps.


Unfortunately, even though the symptom appears identical, it doesn't look like the solution will be identical. Your chart is never hidden as best I can tell, so that isn't the problem. Sorry!

Not applicable
Author


John Witherspoon wrote:Unfortunately, even though the symptom appears identical, it doesn't look like the solution will be identical. Your chart is never hidden as best I can tell, so that isn't the problem. Sorry!


Thank you for efforts. But you was right, the problem is related with another thing.

I've just assigned another copy of the app. This dynamic guy doesn't like to be empty. Even one dimension or expression should be there. What did I do?

I removed all dimensions and expressions, and after that I populated it by new sets. In current version it cares about dimensions and expressions sequentially - remove old dimensions, add new ones, remove old expressions, add new ones.

Now it works.

Returning to comparison of advantages of your and my approaches. There is one more in my approach - you can change business purpose of the chart by adding or removing dimensions/expressions.

johnw
Champion III
Champion III

Yay! Yours is now working on my machine in both 8.5 and 9.0. Now I can dig in and see what you're doing and how you're doing it, and how the two approaches are similar and different. I DO remember wanting to add expressions in the macro, not just enable them, but it's been so long I can't remember why. I wasn't able to solve it at the time, and you obviously have.

I don't understand what you mean by changing the business purpose of the chart, or if I do understand, then mine does it too. I add and remove dimensions, and hide and unhide expressions. If I understand yours, you add and remove dimensions AND expressions. From the standpoint of what the user sees, it seems like it would look identical. But I could easily have missed something since I've barely started poking at yours. I'll probably do that Monday unless some emergency comes up.

Thanks for posting this!

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'll chime in since my name appeared in this thread.

I have used dynamic charts occasionally, but I tend to avoid them for several reasons.

1. I think they may miss an opportunity to create meaningful charts. The "here's your data, make a chart approach" misses for me. The potential to create invalid charts easily exists. I realize there are exceptions and reasonable disagreements with this position.

2. Prior to V9, almost all solutions required using relatively complex macros, usually in unsupported ways (like changing object properties when executing in Server). These macros can be slow, expensive to maintain and buggy.

3. In many cases, I think Server Collaboration objects are a better approach for "ad hoc" stuff. It takes a bit more training to get users working his way but you get broader capabilities (and admittedly possible garbage charts) Or an experienced user can create them on demand and the user can reuse them.

WIth V9, you can now conditionally show columns in a Straight table. If I was creating a dynamic chart in V9, I would take John's approach of predefining the Dimensions and Expressions, control display with conditionals and scrap the whole macro business. I wonder if someone has an example of this they could share?

-Rob

johnw
Champion III
Champion III

Obviously I don't have an example of that, but perhaps I should build one. I need to download the latest version of 9.0 and start getting familiar with it anyway. Replacing my ancient macro code with something more robust would give me a good excuse.

Since the conditional columns would depend simply on selections, and since selections are independent for each user, this would also seem to solve the "everyone modifying the same chart" problem that the macro approaches seem to have.

Not applicable
Author

Perhaps this small example is what you asked for ?

I know that in this thread, The MASTERS of Qlikview are all here, Rob, John, orka, and perhaps (surely) Paul.

I am new but i follow all thread and this solution comes to me from a thread in this forum.

http://www.takoo.sn/tij/DynamicReportLEMien.qvw

I've put this link because the upload functionnality of the forum does'nt seem to work.

Thanks for the forum.