Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with if Statement

Good Day

Can anyone please help with setting a "default" clear selection for an if statement. I have a variable called vWeek which is assigned the following value

=if(Week = '' ,Week(Today()),Week)

"Week" is a listbox populated with the weeks of the year currently running from week 31 - 46.

I would like to display the selected week value in a textbox. The above formula shows the week value e.g. 43, in the textbox when week 43 was selected in the listbox, but how do I show the current week in the textbox if no week was selected in the listbox. I basically want to do the following

If nothing selected in the week listbox

=if(Week = "Nothing Selected", Show current week, else show week selected)

=if(Week = "Nothing Selected", Week(Today()), Week)

Thank You

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

     =if(GetfieldSelections(Week) = 0,Week(Today()),Maxstring(Week));

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

4 Replies
swuehl
MVP
MVP

=if(GetSelectedCount( Week ) = 1, Week, Week(today()) )

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try this.

     =if(GetfieldSelections(Week) = 0,Week(Today()),Maxstring(Week));

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thank you

Works brilliantly. Exactly what I was looking for.

Regards

Cobus

Not applicable
Author

Hi This will work

ListWeek=1,2,3,4,5,6

=if(GetfieldSelections(ListWeek) = 0,Week(Today()),Maxstring(ListWeek))