Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Search based on common value within a field

I'm creating a television programming tool in Qlikview for a movie channel, which has the broadcast rights to movies during certain time periods. These time periods are called "availability windows". In Qlikview, I've modeled the data to look like this:

Availability Window

-----------------------

Window ID

Movie

Availability Start (MM/DD/YYYY format)

Availability End (MM/DD/YYYY format)

Let's say I have 2 movies with 3 different availability windows each:

IDMovie
Availability StartAvailability End
1Fury03/01/201603/31/2016
2Fury05/01/201605/15/2016
3Fury08/01/201610/31/2016
4Jurassic World04/01/201605/15/2016
5Jurassic World09/01/201609/15/2016
6Jurassic World12/01/201612/31/2016
7American Sniper01/01/201602/28/2016
8American Sniper06/01/201606/15/2016
9American Sniper12/01/201612/31/2016

In the UI, I'll have a two date pickers tied to two variables: vDateStart, vDateEnd. I'll also have a listbox with two entries in it: "First time availability" and "Last time availability".

"First time availability" should search for movies with an availability window that overlaps the time within vDateStart and vDateEnd but also doesn't have any availability windows that end BEFORE vDateStart.

"Last time availability" should search for movies with an availability window that overlaps the time within vDateStart and vDateEnd but also doesn't have any availability windows AFTER vDateEnd.

So let's say the user selects vDateStart as 03/21/31 and vDateEnd as 06/21/31 and selects first time availability. Qlikview should display the availability windows with IDs 1 and 4.

If the user selects vDateStart as 09/01/2016 and vDateEnd as 09/31/2016 and selects last time availability, Qlikview should only display ID 3 since the last availability window for Fury expires within that date range. It won't show ID 5 because Jurassic World has an availability window after that time range between 12/1/2016 and 12/31/2016.

I couldn't even begin to think of the expression in Qlikview to get what I need. Please help!

1 Solution

Accepted Solutions
sinanozdemir
Specialist III
Specialist III

Hey Jay,

Hopefully, the attached should do it. I cannot open what ChiragPradhan attached. However, here is my solution:

Capture.PNG

Let me know if this works for you.

Thanks.

View solution in original post

10 Replies
sinanozdemir
Specialist III
Specialist III

Hi Jay,

I think I am getting closer to what you need:

Capture.PNG

Although, when I type 03/21/2016 and 06/21/2016 and choose "First Time Availability", I am pulling IDs 1,2, and 4:

Capture.PNG

I placed the expression to pull IDs, but I did it quickly so I am not sure if it works for other scenarios:

Capture.PNG

I am attaching qvw in case it is what you are looking for.

Hope this helps.

Not applicable
Author

Hey, Sinan. I clicked on Last Availability and I wasn't getting any results. Did you make any changes after that screenshot?

Edit: Also, I changed the vDateStart to 04/01/2016 and it should not have shown Fury 05/01/2016-05/15/2016 because there was a previous window for Fury between 03/01/2016 and 03/31/2016.

sinanozdemir
Specialist III
Specialist III

Hey Jay,

The original qvw on my work pc so I won't be able to get to it till tomorrow. I will take a look at it.

sinanozdemir
Specialist III
Specialist III

Hey Jay,

So can you give me some examples?

If vDateStart = 04/01/2016 and vDateEnd = 06/21/2016, what movies should appear when first time availability and last time availability are chosen?

Thanks

Not applicable
Author

I've added an additional movie to give you a better idea of the logic requirement.

Assuming vDateStart is 04/01/2016 and vDateEnd=06/21/2016:

If first time availability is chosen, ID 4 should selected.

If last time availability is chosen, no IDs should be selected because all 3 movies have an availability window past that date range.

Now let's assume vDateStart is 09/01/2016 and vDateEnd is 09/31/2016:

If first time availability is chosen, no IDs should be selected because all 3 movies have an availability window before that range.

If last time availability is chosen, ID 3 should be selected because Fury doesn't have any availability window that begins beyond that date range while American Sniper and Jurassic world both have an availability window for December.

sinanozdemir
Specialist III
Specialist III

Thanks Jay. Let me work on this and hopefully I will have an answer for you soon.

ChiragPradhan
Creator II
Creator II

Hi Jay

Find attached a a test qvw. See if it works for you.

Regards

Chirag

sinanozdemir
Specialist III
Specialist III

Hey Jay,

Hopefully, the attached should do it. I cannot open what ChiragPradhan attached. However, here is my solution:

Capture.PNG

Let me know if this works for you.

Thanks.

Not applicable
Author

This is exactly what I need. Thank you!