Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Save Selections On "No Data"?

Hiya Guys,

I have a ListBox of Employees, and a Calendar Slider for Start/End Dates.

If "Employee A" is chosen from the ListBox, then all their corresponding data is generated in a Straight Table.  This works well.

However, if the Slider dates are altered so that the timespan does not return any data for "Employee A" then the Selection within the ListBox is cleared.

Is there any way to retain this Selection even though no data is available?

I believe what I'm asking is if there's a way to force precedence over Selection Criteria? (so Timeline would be last?).

As I'm writing this I think the answer is no... but any ideas are most welcome!

Cheers,

Steve.

1 Solution

Accepted Solutions
Not applicable
Author

Hiya Michael,

I've looked into this and, unfortunately, it would get too complicated trying to keep track of all Selections in the "front end".

The solution I've come to (which solves the issue to some extent) is to create a Document Trigger on "OnAnySelect" which (using "Select In Field") automatically selects the current Calendar Slider's date range.

This has the effect of always ensuring the timeline criteria is correct for what the Slider is showing (and therefore setting the precedence of the time criteria to override any previous Selections and removing any invalid Selection).

It's not ideal, but it does work quite well.

Cheers,

Steve.

View solution in original post

9 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try to conditionally use the expressions like

=If(Sum({<Employee, DateSelection>}) > 0, then use this expresson(Sum({<Employee, DateSelection>})), else use this expression (Sum({<DateSelection>}))

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hiya jagan,

Thanks for your reply.

Unfortunately I cannot get your expression to work.  Also, I'm not sure it will help.

The issue is that, once a Timeline selection is made which removes the current Employee selection, then re-selecting a valid Timeline span loses the previous Employee criteria.

Would your idea address this?  I am getting an "Invalid Expression" error with (see underlined closing parenthesis):

 

=

If(Sum({<Employee, TimelineDateNumber>})> 0, Sum({<Employee, TimelineDateNumber>}), Sum({<TimelineDateNumber>}))

jagan
Luminary Alumni
Luminary Alumni

Hi,

That is not actual expression, it is a algorithm,

Try this expression replace with your Dimensions and Measures

=If(Sum({<DateSelection={'=$(=SelectedDateInSlider)'}>} Measure) > 0, Sum({<DateSelection={'=$(=SelectedDateInSlider)'}>} Measure),

Sum(Measure))

Hope this helps you.

Regards,

Jagan.

Gysbert_Wassenaar

No, if you make a selection that contradicts selections in another field then the other field is cleared. The only way to keep selections from influening those in another field is to make sure the two listboxes (or other objects you make selections in) are assigned to different alternate states (available in QV11).


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you Gysbert,

That makes sense... however, unfortunately, if I assign them both the separate Alternate States then the selection won't work correctly  😞

I thought about perhaps trying to "save" each selection as it's made, and then re-applying it once data becomes available?... but not sure if that would work either?...

Cheers,

Steve.

Anonymous
Not applicable
Author

Steve,

I have to tell that your question is not clear.  In any case, I think there is a solutiuon, and it is on the data model level rather than front end expression.
What is the meaning of Date for Employee in your case?  Do you mean start and and end of employment?  If this is true, I'd keep Date disconnected, as logical island.  The relation between Employee and Date are handled in expression.  If date range covers at least one day of employment, the employee is shown.
See attached example.

Regards,
Michael

Not applicable
Author

Hiya Michael,

Thank you for taking the time to respond with an example.

I will attempt to explain my issue slightly better  🙂

I have a ListBox of Employees, for Selection.  I also have a StartDate/EndDate Slider which limits Time Entry data between the selected dates.  So, for example, the User can view all time, by day, for "Employee A" - which they have logged (entered) between 01/Jan/2013 and 12/Mar/2013.

This works as expected, until a date range is selected which returns no data for the selected Employee(s).

So, for arguement's sake, let's say we select all Employees beiginning with the letter "E" - then select the date range 01/Jan/2013 to 12/Mar/2013... this returns 100 rows of data for the Employees whose names begin with "E".

However, if we then select a different date range (01/Jan/2013 to 2/Jan/2013) which has no corresponding data - then the original selection of "all Employees beginning with the letter E" is cancelled (as there are no possible values for the Selection).

If I then choose date range 01/Jan/2013 to 12/Mar/2013 the data displayed will be for ALL Employees (as the Selection had been cancelled) not "all Employees beginning with the letter E", as expected/required.

Does this make more sense?

I will explore a solution using the example you have provided - but I think this solves a slightly different issue?

Cheers,

Steve.

Anonymous
Not applicable
Author

In this case, just replace, in my example,  "condition" expression in the table with 1.

If it's still not what you need - post an example of your application.

Regards,

Michael

Not applicable
Author

Hiya Michael,

I've looked into this and, unfortunately, it would get too complicated trying to keep track of all Selections in the "front end".

The solution I've come to (which solves the issue to some extent) is to create a Document Trigger on "OnAnySelect" which (using "Select In Field") automatically selects the current Calendar Slider's date range.

This has the effect of always ensuring the timeline criteria is correct for what the Slider is showing (and therefore setting the precedence of the time criteria to override any previous Selections and removing any invalid Selection).

It's not ideal, but it does work quite well.

Cheers,

Steve.