Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Store selected field value in variable

Hi,

I have a calendar object which uses the date field of table calendar.

How can i store the value of this field into a variable when user selects a single value.

eg:

if user selects 1/1/2013

variable vcaldate should be 1/1/2013

if user reselects to 1/10/2013

variable vcaldate should be 1/10/2013.

Thanks in advance.

Aaditya

6 Replies
Not applicable
Author

Hi,

you can use trigger to set the variable with selected date:

goto- document properties->triggers

in field event trigger box, select date( required field)

->then press on onselect button.

->a dialogue box apears, then add event:

->action type external and action set variable

->after that u set variable name as vcaldate and value as

=

GetFieldSelections(Date)

Niranjan M.

Not applicable
Author

HI Niranjan,

Thanks.

I tried working through this and it worked for day or month or year but when i try this as a complate date, this does not work.

Ex:-

i create a table as:-

 

load


date(date#(20130101,'YYYYMMDD')+RecNo()) as [Date]
autogenerate 365;

when this value is stored in load event of the document in variable vCalDate, this is not getting the default value.

Even if it does, it return garbage when fetched in any text box.

Aaditya

Not applicable
Author

Hi,

Please post a sample copy of your application.

Niranjan M.

er_mohit
Master II
Master II

try this

use variable like v1 with expression

=(SubField(GetcurrentSelections(),':',-1)) // for particular selection

SubField(GetCurrentField(Date),':',-1) // for define field name.

hope it helps

atsushi_saijo
Creator II
Creator II

This is excellent! I also have had similar challenge. I immediately implemented it. So I think $::Year does not work in this case?

atsushi_saijo
Creator II
Creator II

I also succeeded by creating a value:

Set vYearOnDemand = GetFieldSelections(Year);


We can use vYearOnDemand as double-dollar-sign $(=$(vYearOnDemand)) as variable.

======Sample App=========

Test: LOAD * INLINE [

    Year,Value

    2014,15

    2013,14

    2012,18

    2011,13

    2010,17

    2009,15

    2008,14

    2007,17

    2006,20

    2005,14

];

Set vYearOnDemand = GetFieldSelections(Year);