Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

listbox selection to load certain data

Hi all,

I am currently loading various qvds based on their date.  the user can type into an input box the values which they wish to load.  I want to change this to just selecting from a listbox instead of having to manually type the dates in?

I tried putting the variable as concat(Date, ',') but the function cannot be used in the script.

Has anyone ideas?

Just to clarify - I want to enable the user to select in a list box which dates they want to reload the data for?

thanks

1 Solution

Accepted Solutions
Not applicable

Re: listbox selection to load certain data

Hi,

Don't write your expression in variable "vABC" just leave it empty.

Consider your LoadedDate field is "CreatedDate"

Go to Document properties --> Triggers --> FieldEventTriggers

And selecte the field "CreatedDate"  and Click On Select Add  Action --> External --> Set Variable -->  Variable = vABC and Value = if(getselectedcount(ABC)>0, concat(getfieldselections(ABC), ','), getfieldselections(ABC)).

Hope now you will get the solution.

Regards
Venkat

18 Replies
Not applicable

listbox selection to load certain data

Hi

I did something similar hope it helps;

My application takes start and end date  and puts them into a for loop and to create a inline calendar  which is stored in calendar.qvd.

Then you can create your calendar table and put your date field  into listbox so users can select what theyn wish...

Brief example is below

/*

Let A=1;

let nextperiod= V_Calendar_Start;

int_nextperiod =Interval(nextperiod);

int_V_Calendar_Start=Interval(V_Calendar_Start);

int_V_Calendar_End=Interval(addmonths(V_Calendar_End,1));

For int_nextperiod =int_V_Calendar_Start to int_V_Calendar_End 

Calendar:

LOAD * INLINE [ID, EFFECTIVE_START_DATE, YEAR,MONTH,Composite

   $(A),$(Cal_date) 00:00:00,$(Cal_year),$(Cal_month),$(Composite)];

 

A=A+1;

nextperiod= addmonths (nextperiod,1);

int_nextperiod =Interval(nextperiod);

 

NEXT

 

store Calendar into QVD\Calendar.qvd (qvd);

*/

Good luck

Max

Highlighted
Not applicable

listbox selection to load certain data

Thanks,

I have a loop created and a list of dates, eg 201202, 201203, 201204 etc.

My qvds are names 201202.qvd, 201203.qvd etc.

My issue is how do i translate my selections in this listbox into the dates on which I should perform my loop.

eg.  I select 2 dates in my list box 201202 and 201203, my loop should then only reload the 201202 and 201203 qvds?

Not applicable

listbox selection to load certain data

Firstly I would find how many values are selected in your list box by using GetSelectedCount(Your_Field Name)

Then put this number in to a foor loop

For .....

get the selections on your list box by using GetFieldSelections(Your_field_name)  into a variable ( Var_qvd) then

Load *

from

.... myqvd_$(Var_qvd);

Next

Hope it helps...

Max

Not applicable

Re: listbox selection to load certain data

Hi colgbre01,

Tyr the attached sample qvw file.

I hope it might be helpful to you.

Regards
Venkat

Not applicable

listbox selection to load certain data

Hi,

The issue for this is that when the variable is created the script does not recognise the getfieldselections function?  this may work on a text box on the front end but when coming to a load it simply gives tries to load from:

abc.getfieldselections(fieldname).qvd which obviously does not exist!

Not applicable

Re: listbox selection to load certain data

could you resend as a zipped file and not 7zip please satish?

Regards.

Not applicable

Re: listbox selection to load certain data

Hi,

Please check the zipped file.

Regards
Venkat

Not applicable

Re: listbox selection to load certain data

Great,

Looks exactly what i need...One more thing, could you post what the two variables are vSample and vABC?

Thanks

Not applicable

Re: listbox selection to load certain data

Hi,

vABC variable will holds the values selected in the field values of  "A" after clicking on the button .

vSample variable will holds the values of vABC values.

i.e; if vABC holds like 201202,201203 then vSample in first for loop holds 201202 and in second for loop holds 201203.

I hope you understand now.

Regards,
Venkat

Community Browser