Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select values from listbox with expressions using javascript

Hi everyone. I'm trying to do selection of listboxes' values from javascript.

First of all, I'm a newbie.

The current code I'm using is like

var qvDoc = Qv.GetCurrentDocument();

var qvListBox = qvDoc.GetObject("LB05")

qvListBox.QvaPublic.Data.SelectTexts(["=[FIELDNAME]='something']);

which is working fine while I'm doing selection over a listbox with field values.

The problem:

I have created listbox (let's call "LB06") where values are calculate by the expression: Day(WeekStart(MY_DATE))&'-'&Day(WeekEnd(MY_DATE))&' '&Month(MY_DATE).

Resulting values are:

15-21 apr

13-19 mag

20-26 mag

17-23 giu

The question is:

While in the first case of listbox, I'm using  [FIELDNAME] to access FIELDNAME values and do the proper selection, how can I get access to values given by the expression Day(WeekStart(MY_DATE))&'-'&Day(WeekEnd(MY_DATE))&' '&Month(MY_DATE) ?

Let's say, for instance, that I'd like to select 15-21 apr.

A try was to access values with something like 

qvListBox.QvaPublic.Data.SelectTexts(["=Day(WeekStart(MY_DATE))&'-'&Day(WeekEnd(MY_DATE))&' '&Month(MY_DATE)='15-21 apr']);

obviously for the Object LB06

But that's not working.

Since I'd like to make the proper selection on document opening, another try would be to trigger the sheet opening event (onActivateSheet) with the selection action. But in this case I also have the same problem of how to access values of a "calculated expression listbox".

Thanks in advance

0 Replies