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

How to use Slider and GetObjectField function


Hi,

I am using a slider object to determine how many computers are remaining to be upgraded at a particlar date and time. A particular Date and Time is selected by the Slider and its input comes from from "Slider Date" column from the Table. When a user selects a date from the slider, the output must display, "the number of Computers" where the "Upgrade Date" is 'After" the "Selected" Slider Date. In the appended table, if we select row 5 as Slider input, Slider Date "01/31/2014 10:45 AM", then the output is 3. Three computers were waiting for upgrade - Computer3, Computer4, and Compurt5, because their upgrade date is "After" the selected Slider Date. Computer1 already started upgrade process at 10:10 am and Compter2 started 10:20 and, so they are excluded from the count. We also do not want to count computers beyond the selected "Slider Date", whcih in this case is row 6 through row 10.

I use Slider object with "Slider Date" as Data Field input, with Mode "Single Value".

I want to use "Table" object to display Numbers. I used no dimension. I used "GetObjectField" function to get the date field, but it does not provide any output. Can comeone help me understand how to get the "Value" from the slider and use it as input to "Table"? I appreciate. Thanks,

ItemsSlider DateUpgrade Date
1Computer11/31/2014 10:08 AM1/31/2014 10:10 AM
2Computer21/31/2014 10:16 AM1/31/2014 10:20 AM
3Computer31/31/2014 10:20 AM1/31/2014 11:25 AM
4Computer41/31/2014 10:30 AM1/31/2014 12:23 AM
5Computer51/31/2014 10:45 AM1/31/2014 1:19 PM
6Computer61/31/2014 10:56 AM1/31/2014 1:41 PM
7Computer71/31/2014 12:01 PM1/31/2014 1:32 PM
8Computer81/31/2014 12:21 PM1/31/2014 2:03 PM
9Computer91/31/2014 12:12 PM1/31/2014 2:38 PM
10Computer101/31/2014 12:42 PM1/31/2014 2:29 PM

Message was edited by: Raghavendra Rao I poseted QVW file

11 Replies
richard_pearce6
Luminary Alumni
Luminary Alumni

Something like

Count ( {<[Upgrade Date] = {">[Slider Date] "}>}  Items )

Richard

qlikcentral.com

Not applicable
Author

I appreciate you fast response. I want to use the Expression above in the "Table" object. But how do I get the value from the "Slider" object and then insert that value into my Expression within the Table object? In the Table object, I want to display the count as number. I am having diffifculty getting the "field value" from slider. I used "GetObjectFiled" function and "GetFieldSelection".

richard_pearce6
Luminary Alumni
Luminary Alumni

Hi,

It would be something similar like

Count (1 {<[Upgrade Date] = {">$(=GetFieldSelections([Slider Date])"}>}  Items )

Try adding the '1' above also, looking at your dataset selecting the Slider Date will reduce you data by association and this will ensure you're querying the full dataset.

If you're still having issues post an example app and I'll have a look for you

Regards

Richard

qlikcentral.com

Not applicable
Author

Hi Richard,

I applied the expressions and it did not seem to work. I uplaoded the qvw file. If you have or anyone else can suggest what functions is appropriate, that will be helpful.

Thanks,

Raghu

richard_pearce6
Luminary Alumni
Luminary Alumni

The qvw isn't showing (sometimes there's a delay), once its up I'll have a look for you.

Richard

Roop
Specialist
Specialist

In the script .....

MainDates:

LOAD F1,   

Items,   

[Slider Date],   

[Upgrade Date]

FROM slidertest.xlsx (ooxml, embedded labels, table is Sheet1);

SliderLoad:

LOAD

[Slider Date] as SliderOnScreen

Resident

MainDates;

I created the slider with the field SliderOnScreen.

I created a chart with an expression very similar to the one above:

count ({1<[Slider Date] = { " <$(= date(GetFieldSelections([SliderOnScreen])))"}>}  [Slider Date] )

I hope that this helps

Not applicable
Author

I appreciate you fast response. I implemented above script exactly. It did not work. I believe in the "Count" expression, the [Slider Date] is actually [Upgrade Date]. I replaced that slider date with upgrade date, but it did not display the count in the Chart.

Not applicable
Author

With the load script that Robert suggested, you could use the expression:

=Sum(Aggr(If(SliderOnScreen >= [Upgrade Date], 1, 0), [Upgrade Date]))

Roop
Specialist
Specialist

I think that the only reason that this would not work would be that you have not converted your date fields correctly and the field being loaded is not a date.

Can I suggest that you use a simple test file from Excel to check the functionality first and then check to see ifyour date is correct. The area of date conversion in QlikView can be very frustrating and is probebly the reason for the application not working.

I hope that this helps