Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner
Partner

How to display the data based on Input value

Hi,

I have a input box in that i can able to select the values from 1 to 100 with step 10(i.e, 1,10,20,30,40,50,60,70,80,90,100). I have different fields for carrier table in the edit script. CarrierID is one field among that table. If i select 1 or 10 or 20 etc from the input box. I want to display the last n CarrierID records(i.e n=1 or 10,20) along with other fields of carrier table. How can i do this plz help me.

8 Replies
pat_agen
Specialist
Specialist

Hi Boppy,

when you read the data into qv for Carriers do you have one record per carrier?

If so read in the data and add a field like this

rowno() as CarrierIdSeqNbr

this will go from 1 to n depending on how many Carrier records you have read.

at the end of the load put the last CarrierSeqNbr into a variable like this

set vMaxCarrierSeqNbr=peek('CarrierSeqNbr',-1,name of table you just loaded);

you have yourvariable from your drop down box giving how many records you want to see (let's call this vNbrRecordsToDisplay) , you have the maximum record loaded and each Carrier record has a sequential number attached to it.

now use an if clause in your expression

dimension CarrierId

if(CarrierIdSeqNbr>$(vMaxCarrierSeqNbr)-$(vNbrRecordsToDisplay),1)

set supress missing to yes on the presentation tab.

yourchart will show the last n CarrierIds based on your input value.

hope this helps.

jagannalla
Partner
Partner
Author

Hi PatAgen,

Thanks for responding to my task. I did as u said but it's not working. But one think i didn't understood, u said that at the end of load set the variable by using peek function. What is the use of it. I'm attaching the screen shot of edit script what i did can u check once and give reply whether it is correct or not.

jagannalla
Partner
Partner
Author

Hi PatAgen,

Thanks for responding to my task. I did as u said but it's not working. But one think i didn't understood, u said that at the end of load set the variable by using peek function. What is the use of it. I'm attaching the screen shot of edit script what i did can u check once and give reply whether it is correct or not.

pat_agen
Specialist
Specialist

I can't see your edit. try attaching your qvw file and I'll give it a look over.

The peek function reads one specific record from a given table.

in my answer it i used as the way of recovering th elast Sequential number so as to have in a varaibale the maximum numbre of rows.

jagannalla
Partner
Partner
Author

pat_agen
Specialist
Specialist

Hi Boppy,

I can see the code now! The peek,order should look like this:

peek('CarrierIdSeqNbr',-1,Carrier)

the tablename should be the one in qv not the one in your sql database.

remember to sort your sql query to get your Carrier id in the right order.

pat_agen
Specialist
Specialist

ok

the peek command is corrected. are you still having an issue?

jagannalla
Partner
Partner
Author

Hi PatAgen,

It's not working. Can u attach the qvw file what you have developed.