Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bullish35
Creator II
Creator II

Force initial position of scrollbar

I'm displaying data by CalendarWeekEnd. The max date is displayed on the far right. I would like the default view of the object to appear as below:

error loading image

I have Preserve Scroll Position enabled, but that doesn't help until manually scrolling to the right for the first time. I have also tried using 'OnOpen' triggers - in conjunction with Preserve Scroll Position - to select the maximum date in the date field and then clear the date field. Didn't work. Any ideas? I'm using v9.0 SR 6.

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

By coincidence, at this very moment I need this for a chart I'm working on, I've never done it before, and I'm on the same version of QlikView as you. It appears from the API guide that this should work:

set chart = ActiveDocument.GetSheetObject("CH23")
set chartProperties = chart.GetProperties
chartProperties.ChartProperties.XScrollInitRight = true
chart.SetProperties chartProperties

Except that it didn't. Ah! It didn't work when I clicked the button to execute the macro manually, but it DID work when I closed out the application and went back in, with this being triggered on open. So I guess it works?

View solution in original post

12 Replies
johnw
Champion III
Champion III

By coincidence, at this very moment I need this for a chart I'm working on, I've never done it before, and I'm on the same version of QlikView as you. It appears from the API guide that this should work:

set chart = ActiveDocument.GetSheetObject("CH23")
set chartProperties = chart.GetProperties
chartProperties.ChartProperties.XScrollInitRight = true
chart.SetProperties chartProperties

Except that it didn't. Ah! It didn't work when I clicked the button to execute the macro manually, but it DID work when I closed out the application and went back in, with this being triggered on open. So I guess it works?

bullish35
Creator II
Creator II
Author

Hmm, very curious. I think I'll give it a try.

Hey, if it works on open - for any user with access - I'd say it works! Have you tried publishing the app yet? Any difference in the behavior, especially when trying to trigger using the button, in AJAX?

johnw
Champion III
Champion III

Yeah, exactly, as long as it scrolls right on document open, that should be good enough in practice.

No, I haven't published yet. Probably Monday.

johnw
Champion III
Champion III

Published. Works fine.

johnw
Champion III
Champion III


Ellen Blackwell wrote:Any difference in the behavior, especially when trying to trigger using the button, in AJAX?


We don't normaly use AJAX, but now that it's published I can test this.

The macro on open does NOT put the scroll bar to the right in AJAX, at least with our setup. If you're using AJAX, it looks like you'll need another solution.

bullish35
Creator II
Creator II
Author

Yes, that has been my experience with macros in AJAX. Neither buttons nor triggers work in the published app. It must be a settings issue. But I'm glad you have a solution for the scrollbar position in your app! I recall searching for info regarding macro functionality in published apps using AJAX; don't recall finding anything definitive on the matter. I think I'll submit a more general post. Thanks John.

Not applicable

Guys, I have not written Macro in qlikview yet. can you please help me how exactly should i put the 4 lines you mentioned above? I tried putting them as they are and it shows syntax errors. Thank you.

Not applicable

I don't know much about macros but I have 32 charts in one QVW that I would like to force the scrollbar to the right of the chart by default. I did run your macro and all the 32 charts have now the scrollbar to the right. I then deleted the macro from my QVW but the scrollbar position remained to the right. I have saved the QVW many times after that and also made a copy of it and all the charts remain with the scrollbar to the right. Is there something in the background related to the macro that is still running? I thought after I deleted the macro code all scrollbars would go back to its Qlikview default (left) position. I wonder if the scrollbar will remain on the right side. Any thoughts?

   set chart = ActiveDocument.GetSheetObject("CH100")

   set chartProperties = chart.GetProperties

   chartProperties.ChartProperties.XScrollInitRight = true

   chart.SetProperties chartProperties

Not applicable

Go to Tools and Edit Module and paste John's code replacing "CH23" Object ID with yours. You can find your chart Object ID under the chart's properties (General tab).

I did use the macro as shown by John and it worked for me. The only difference is that I added my Object ID and removed his ("CH23"). My object ID is CH100 thus:

set chart = ActiveDocument.GetSheetObject("CH100")

   set chartProperties = chart.GetProperties

   chartProperties.ChartProperties.XScrollInitRight = true

   chart.SetProperties chartProperties