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: 
Peony
Creator III
Creator III

VBA script. Values selection by condition

Hi all!

There is two tables. Each table is in a separate list box.
If I select in "YM" table some value, for example "2017 08", "2017 07" or "2017 06" in "YQ" automatically should be selected "2017 Q2". If I choose "2016 12", "2017 01" or "2017 02" - "2016 Q3". And so on for other years and quarters. Tha common dependensy is:

Month     | Quater

03,04,05 | Q1

06,07,08 | Q2

09,10,11 | Q3

12,01,02 | Q4

Script shoud be realise on VBA and I confused how to do this cause totally rookie in VBA. Please, help me to understand.

LOAD * INLINE [

    YQ

    2017 Q3

    2017 Q2

    2017 Q1

    2016 Q4

    2016 Q3

    2016 Q2

    2016 Q1

    2015 Q4

    ..............

    2014 Q1

];

LOAD * INLINE [

    YM

    2017 11

    2017 10

    2017 09

    2017 08

    2017 07

    2017 06

    2017 05

    2017 04

    2017 03

    2017 02

    2017 01

    2016 12

    2016 11

    2016 10

    ............

    2014 01

];

1 Solution

Accepted Solutions
m_s
Partner - Creator II
Partner - Creator II

Hello again Nataliia,

I would not recommend VBA for this kind of task unless you absolutely have to. Maybe it is enough if you link those fields in your data model?

Check out the attached app (especially the load script). If you want to automatically select values in YQ assign a OnSelect trigger to the YM field and chose "Select Possible".

Mathias

View solution in original post

2 Replies
m_s
Partner - Creator II
Partner - Creator II

Hello again Nataliia,

I would not recommend VBA for this kind of task unless you absolutely have to. Maybe it is enough if you link those fields in your data model?

Check out the attached app (especially the load script). If you want to automatically select values in YQ assign a OnSelect trigger to the YM field and chose "Select Possible".

Mathias

Peony
Creator III
Creator III
Author

Hello again And again, thank you for your attantion and help.

I woul love not to use VBA till I will get more competenion in it. But the thing is that my boss asked me to provide some changes into allready exist dashboard. So I cannot change the method for solving this task. Just trying to do my best with parts that I allready know and asking for help where i am quite zero.


Never the less, your example is really useful. Will work with it, because task still need to be solved.