Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Input box with Predefined values coming from a Field

Hi,

I can't seem to get this to work...

I just need an input box to set a value for a variable, but want to constain the possible values to what is stored in a particular field (a drop-down list would be the best).

Any pointers?

TIA

--

bob

19 Replies
Miguel_Angel_Baeyens

Hi,

Check the attached.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

pat_agen
Specialist
Specialist

hi,

just tried the first version again

=concat(distinct date(Timestamp,'YYYY-MM-DD'),';')

and it still works fine over here (am on v8.5). Have you tried starting over and with creation of a new variable? Apart from that only help I can give you is if you load your qvw as there may be something in there preventing this working ok.

Not applicable
Author

Hi , I have a similar requirement, however, my input field is in TableBox. Basically I have a TableBox with two columns. One of the columns in InputField. So a particular cell in that column can be edited. However, I want to restrict user to be able to enter a value only from one of the existing values for column. Is this even possible?

jslancas
Contributor II
Contributor II

I have done the same thing, although I'm not using dates, and it works great. 

One note, though, which should help @rajayaad is that if you replace the semi-colon with a comma, it will force a carriage-return, which will allow you to see the data in a column and just click (using a drop-down box) to select one of the items (rows).  Then you can use the variable in a selection filter, or other expression.  This is what I am using in the Constraints/Listed Values expression:

='None Selected,' & Concat(DISTINCT Replace(primpract_res_name,',','_'),',')

I also added 'None Selected' to the top of the list and forced a carriage-return after it, by including a comma.  Since the field that I am using actually has commas in the field values themselves, I had to replace the comma with an underscore ("_"), then swap them back at the time of use.  Otherwise, first names are listed on one line and last names on the next, which doesn't work.  If you don't have commas to deal with, just use something like this:

='None Selected,' & Concat(DISTINCT fieldname,',')

'Hope this is helpful.

Not applicable
Author

Thank you all, this is very helpful. I used what Jeff posted and here is my current Expression for which values to show as 'listed values'

='None Selected,' & Concat(DISTINCT {<File_Date=>} Replace(Date(File_Date,'M/D/YYYY'),',','_'),',')

I want to now sort the dates in descending order so when the user selects the dropdown they see the most recent dates first. How do I add a 'sort' into this expression?

Thank you in advance!

-Michael

Not applicable
Author

Hello:

The following should work:

 

=Concat(DISTINCT Date(File_Date,'M/D/YYYY'),',',Num(File_Date)*-1)

Num(File_Date)*-1 sorts by descending. Just use File_Date if you want ascending.

 

Regards,

Ben D.

Not applicable
Author

Hi Shanti,

You'll just need to replace the semicolon with comma:

=concat(distinct YourFieldHere),',')



madhumitha
Creator
Creator

This worked for me Shanti,

Thanks for the help.

anguila
Partner - Creator
Partner - Creator

Just to highlight the issue.. If you use a predefined/static string in the list values, like: 1;2;3;4, you need to separate them using semi colon, ;.

But if you're using an expression, you have to separate them with coma.

That's why, in previous comments, some people were saying they had date1;date2;date3 in one single row and not in a drop down list.

Not applicable
Author

Thank you David 🙂