Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QVW INSIDE~Does Authentication setting of QV Web Server affect Macro running properly?

Does Authentication setting of QV Web Server affect Macro running properly?

If Authentication setting is Always, the macro below is good working. If 'Never', the macro is not working well. error loading image

my macro:

sub getCompanyMoneyCityRank
set chart = ActiveDocument.GetSheet(0).CreateStraightTable '?????
chart.AddDimension "=if(aggr(Sum ({$<???={$(V_CITYNAME)},??????=>}??),??????)>=t,??????)" '??t???????????????
chart.AddExpression "Sum ({$<???={$(V_CITYNAME)},??????=>}??)" '??????????
set cp = chart.GetProperties
set dims = cp.Dimensions
dims(0).NullSuppression = true '?????
chart.SetProperties cp
count = chart.GetRowCount-2 '????????????????????count
call UpdateVarValue("V_Company_Money_CITY_RANK",count) '?count??????V_Company_Money_CITY_RANK
chart.close
end sub


8 Replies
Not applicable
Author

Can any one guide me? thanks again

Not applicable
Author

Hi, here is the simple qvw file which is not working well with Authentiaction Setting set 'Never'.

Anonymous
Not applicable
Author

My guess would be that when you access a document anonymously, you're not allowed to create a chart using the macro since you need to be authenticated to create a collaboration object on the server. When you have authentication active, QVS can properly attach that object to the authenticated user.

Not applicable
Author

Hi,

Can I do something which can solve this problem?

Anonymous
Not applicable
Author

Well.. yes.

First of all I'm not sure why you want to run a macro to create a chart?

It doesn't make much sense to me to run a macro to let each used create an identical collaboration object on the server. If you want the object in the document, I would add it in the actual document layout.

This part just creates the same Straight Table over and over:

set chart = ActiveDocument.GetSheet(0).CreateStraightTable
chart.AddDimension "=Month"
chart.AddExpression "Sum (Amount)"
set cp = chart.GetProperties
set dims = cp.Dimensions
dims(0).NullSuppression = true
chart.SetProperties cp

Not applicable
Author

Hi,

I think there are several reasons why I run a macro to create a chart :

1, I want to calculate the rank of the DeptX in ScoreY. For example, assume there are a table. The DeptId and ScoreY are input by user from input box. And the ScoreY could from Score1 to Score99999.

2, I have a number of objects in the sheet. I worried about the performance if there are so many tables in the sheet even we can hide them.

3, I want to show ALL of the DeptId in the sheet. So I can't select a DeptId in the sheet to avoid only show one dept's information.

4, The table is not the static table in the database, it is dynamic created depands on user's select in the other sheet. So I can't use RANK funtion.

DeptIdScoreAScoreBScoreC
dept1764534
dept2755476
dept3459875
dept4543476
dept5987675
dept6347545
dept7234554
dept8234534
dept9445432
dept10789875


So I think maybe I can dynamic create a chart by user demand to calculate the rank. It is better than add dozens of opjects in the actual document layout.

And what's more, I want to make myself clear Smile

Anonymous
Not applicable
Author

Thanks for the long description. I'm still unclear of why the macro usage though. Also I'm not certain how this new description relates to the old example file provided.

Could you provide an example file with regards to the departments, and a step by step possible user input, and what you'd expect to see. I'm fairly certain you could create one dynamic chart that let's you show the values you want to see without the use of macros.

Not applicable
Author

Hi,

Thank you for your reply. It's a good question, The discription does no relate to the old exmple. But it is difficlut for me to tell the relattion clearly. Because my real data ,script and all object name(property) are edit in Chinese charactor. So in my early post, I tried to simple the question in English with an assumptive example. And make you confused. Cool

Give me a little time to translate...