Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Last week I started my first job IT job as trainee QV developer. My first task is to maintain a QVW.
There is button in the QVW that I know what is doing (show results by Continent and Country) but I could not get the logic of the expression competently:
=Pick(2 - Mod(Match(vLevel, 'Country', 'Continent') + 1, 2), 'Country', 'Continent')
I already know what each of the 3 function do (when they are separated), but I am getting confused with that nested function between the mod and the match.
Could someone please explain me what going on between the Mod and the Match?
Thank you for your help!
The match function returns an integer: 0, 1 or 2. The Mod function takes the modulus 2 of that number after 1 is added to it. So it returns 0 or 1. The pick function the picks the first (2 - 1) or second (2 - 0) value in the list of 'Country', 'Continent'
It's an unnecessarily complicated expression. I find this clearer: =If(vLevel='Country','Continent','Country')
It seems that when vLevel = Country, then the expression will output Continent. When vLevel =Continent, then the expression will output Country. This seems like a very complicated solution to a simple problem. Can you try if the below expression gives the same output as the one you have provided?
=Pick(Match(vLevel, 'Country', 'Continent'), 'Continent', 'Country')
Here is my interpretation of the results.
If vLevel='Country', then pick 'Continent'.
If vlevel='Continent', then pick 'Country'
if vLevel <> 'Continent' OR 'Country', then pick 'Country'
If I understand the meaning correctly, then I think it's more complex then necessary. I would have written it like this:
=Pick(Match(vLevel, 'Country', 'Continent') + 1), 'Country', 'Continent', 'Country')
-Rob
The match function returns an integer: 0, 1 or 2. The Mod function takes the modulus 2 of that number after 1 is added to it. So it returns 0 or 1. The pick function the picks the first (2 - 1) or second (2 - 0) value in the list of 'Country', 'Continent'
It's an unnecessarily complicated expression. I find this clearer: =If(vLevel='Country','Continent','Country')
Hi,
I had the same tough and I did the exact same thing. But the button didnt work.
If you put it in the text box it works, but not as an action.
Thank you for your help,
I am going to try your solution to check the result.
Thank you for your reply and explanation, I am getting even closer to the logic of it.
I will also try the alternative solution that you sent me.
Check out the attached qvw, both the buttons are doing the same thing.
Thanks for those, I will check and compare with mine and find out why it didnt work (my one).